Sobes.tech
Junior — Middle

What methods do you use to diagnose and find the causes of applications hanging in Pending state in Kubernetes?

sobes.tech AI

Answer from AI

To diagnose a pod hanging in the Pending state in Kubernetes, you can use the following methods:

  1. Check pod events:
kubectl describe pod <pod-name>

In the Events section, you can see the reasons why the pod is not starting (e.g., insufficient resources, PVC issues).

  1. Check node status:
kubectl get nodes

If nodes are not ready or overloaded, pods may remain in Pending.

  1. Check resource availability: If the pod requires more CPU or memory than available, it will not be scheduled.

  2. Check PersistentVolumeClaims settings: If the pod is waiting for volume binding and the PV is not available, it will be in Pending.

  3. Check quorum restrictions and security policies: For example, PodSecurityPolicies or NetworkPolicies may block the scheduling.

  4. Check the Scheduler: Ensure that the scheduler is running and can assign the pod to a node.

  5. Controller logs: Check the logs of kube-scheduler and kube-controller-manager for errors.

Thus, diagnosis begins with describing the pod and analyzing events, then infrastructure and cluster settings are checked.

What methods do you use to diagnose and find the… - sobes.tech