This guide walks you through diagnosing and resolving Kubernetes pods that remain in a Pending state because they cannot be scheduled onto a node with an available GPU. You will learn how to verify GPU availability, check scheduler events, and correct common configuration issues that block GPU allocation.
What You’ll Need
- Access to the Kubernetes cluster via
kubectlwith permissions to view nodes, pods, and events. - NVIDIA GPU drivers installed on the worker nodes (for NVIDIA GPUs).
- The NVIDIA device plugin daemonset deployed (or the appropriate vendor plugin for your GPU type).
- Basic familiarity with Kubernetes YAML manifests and
kubectlcommands.
Step-by-Step
- Check the pod status and events
Runkubectl describe pod <pod-name> -n <namespace>. Look at theEventssection for scheduling errors such as0/3 nodes are available: 3 Insufficient nvidia.com/gpu. This tells you no node has enough GPU resources. - Verify GPU resources on nodes
Runkubectl get nodes -o json | jq '.items[].status.allocatable'and look fornvidia.com/gpu. If the key is missing, the device plugin is not running or not registered. - Check the device plugin daemonset
Runkubectl get daemonset -n kube-system | grep nvidia. If no daemonset exists, deploy the NVIDIA device plugin. If it exists, check its pods:kubectl get pods -n kube-system -l name=nvidia-device-plugin. Ensure they areRunningand not inCrashLoopBackOff. - Inspect device plugin logs
For a failing plugin pod, runkubectl logs <plugin-pod> -n kube-system. Common errors include missing drivers, incorrect library paths, or inability to access/dev/nvidia*devices. - Verify GPU drivers on the node
SSH into a node and runnvidia-smi. If it fails, the driver is not installed or not loaded. Reinstall the driver and reboot the node. - Check if the pod requests GPUs correctly
Inspect your pod spec:kubectl get pod <pod-name> -n <namespace> -o yaml. Look forresources.limitsandresources.requestscontainingnvidia.com/gpu: 1. If you only setlimitswithoutrequests, Kubernetes may not schedule correctly—set both to the same value. - Check for node selectors and taints
Runkubectl describe node <node-name>to see taints. If the node has a taint likenvidia.com/gpu=present:NoSchedule, your pod must have a matching toleration. Also verify your pod’snodeSelectororaffinitymatches the GPU node labels. - Check if GPUs are already allocated
Runkubectl describe node <node-name>and look atAllocatablevsAllocated resources. If all GPUs are used by other pods, you need to scale down or add nodes. - Check for extended resource registration
If the device plugin is running but the node does not shownvidia.com/gpu, the plugin may not have registered. Restart the plugin daemonset:kubectl rollout restart daemonset/nvidia-device-plugin -n kube-system. - Verify the container runtime supports GPUs
If using Docker, ensurenvidia-container-runtimeis configured. For containerd, thenvidia-container-runtimemust be set as the default runtime in/etc/containerd/config.toml. Misconfiguration here prevents the plugin from seeing GPUs.
Common Mistakes
- Forgetting to set
resources.requestsfor GPUs—only settinglimitscan cause scheduling issues. - Using the wrong resource name, e.g.,
nvidia.com/gpuvsnvidia.com/gpu-memory(the latter is for MIG). - Not adding tolerations for GPU node taints.
- Assuming all nodes have GPUs—verify with
kubectl get nodes -o wide. - Running the device plugin on nodes without drivers, causing crash loops.
Tips
- Use
kubectl get events --sort-by=.metadata.creationTimestampto see recent cluster-wide events that might indicate node issues. - Label GPU nodes clearly, e.g.,
kubectl label node <node> gpu=present, and use nodeSelector in your pod spec to target them. - For clusters with mixed GPU types, use device plugin’s
nvidia.com/gpu.productlabel to differentiate. - Test GPU scheduling with a simple pod like
nvidia/cuda:11.0-baserunningnvidia-smito isolate the issue. - Keep the device plugin version aligned with your Kubernetes version and driver version.
Troubleshooting
If the pod remains stuck after following the steps:
- Re-check the device plugin logs—a common error is
Failed to initialize NVML: Insufficient Permissions. This means the plugin container lacks the necessary device privileges. Ensure your daemonset has the requiredsecurityContextwithprivileged: trueand mounts/devand/var/runcorrectly. - Check if the node is in a NotReady state—run
kubectl get nodes. If a node is NotReady, it won’t be scheduled. Investigate kubelet logs on that node. - Verify that the GPU resource is exposed as an extended resource—run
kubectl describe node <node>and look fornvidia.com/gpuin theCapacitysection. If it’s missing, the plugin hasn’t registered. - Check if the pod is using a GPU resource that is not available—for example, requesting
nvidia.com/gpu-memorywhen the plugin only exposesnvidia.com/gpu. - Look at the scheduler logs—if you have access, check the kube-scheduler logs for detailed reasons why the pod cannot be placed.
Frequently Asked Questions
Why does my pod stay in Pending even though the node shows GPU capacity?
This usually means the GPU resource is already fully allocated to other pods, or the node has a taint that your pod doesn’t tolerate. Check the node’s allocated resources and taints.
Do I need to install the device plugin manually?
Yes, unless your Kubernetes distribution includes it. The NVIDIA device plugin is a daemonset that must be deployed to expose GPUs as schedulable resources.
Can I use GPUs without requesting them in the pod spec?
No, you must explicitly request nvidia.com/gpu in the pod’s resources. The device plugin only allocates GPUs to pods that ask for them.
What does the error ‘Insufficient nvidia.com/gpu’ mean?
It means no node has enough free GPUs to satisfy the pod’s request. Either add more GPU nodes, reduce the number of GPUs requested, or free up GPUs by removing other pods.
How do I know if my GPU driver is working?
SSH into the node and run nvidia-smi. If it shows GPU information, the driver is working. If it returns an error, the driver is not installed or not properly loaded.
What if I use AMD or Intel GPUs?
You need the respective device plugin (e.g., AMD GPU device plugin). The steps are similar, but the resource name and plugin deployment differ.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Install Extensions in Edge Canary Android
- How to Apply for a Church Credit Card
- How to Roll Back Microsoft Edge to an Earlier Version
- Convertible Bonds: Impact on Debt and Share Count
- Python vs SQL: Key Differences Explained
- Fix Chrome Lagging or Slow Opening Issues