How to add GPU in Kubernetes
After you have successfully completed the kubeconfig configuration. If not, you can follow the steps in this link if you are using the Linux operating system, and if you are using the Windows operating system. For the next step you can add a GPU to Kubernetes. Run the following syntax to create a file that will store the GPU configuration.
nano gpu-pod.yamlCopy the code below.
apiVersion: v1
kind: Pod
metadata:
name: gpu-pod
spec:
containers:
- name: gpu-container
image: nvidia/cuda:11.0-base
resources:
limits:
nvidia.com/gpu: 1 # Request one GPU
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: gpu.nvidia.com/class
operator: In
values:
- H100Save the file and exit the text editor. If you're using nano, press CTRL+X, then Y to confirm, and press Enter. Deploy the YAML file using kubectl by executing the syntax below.
Last updated
