Intern
The pod is in Pending state. How to diagnose and fix it?
sobes.tech AI
Answer from AI
If a pod is in the Pending state, it means Kubernetes cannot start the containers due to resource or configuration issues. For diagnostics:
- Run
kubectl describe pod <pod-name>and check the Events section — it often indicates the reasons for Pending. - Check if there are enough resources (CPU, memory) on the nodes. There might be no free resources for the pod.
- Ensure there are no issues with PersistentVolumeClaims if the pod uses volumes.
- Verify that the nodes are available and not in the NotReady state.
To fix the issues:
- If resources are insufficient — increase limits or add nodes to the cluster.
- If there are volume issues — check the status of PVC and PV.
- If there are configuration errors (e.g., incorrect selectors or nodeSelector) — fix the manifest.
Example command to view events:
kubectl describe pod <pod-name>