在一机多卡的节点上,如果只想要pod调度到指定的gpu设备上,可以通过NVIDIA_VISIBLE_DEVICES进行设置,如果不设置默认为 all
apiVersion: v1
kind: Pod
metadata:
name: ndp-gpu-pod-test
namespace: default
spec:
containers:
- name: ubuntu-container
image: ubuntu:18.04
command: [ "bash", "-c", "sleep 86400" ]
env:
- name: NVIDIA_VISIBLE_DEVICES #设置可访问的gpu设备
value: "0,1" #第几个,也可以指定UUID,可指定多个
resources:
limits:
nvidia.com/gpu: 1
tolerations: #GPU节点污点容忍
- key: "gpu"
operator: "Equal"
value: "on"
effect: "NoSchedule