FoxuTech

How to Troubleshoot Kubernetes Pod in Pending State

How to Troubleshoot Kubernetes Pod in Pending State

Part of our Kubernetes troubleshooting series, in this article will see how to troubleshoot, pod on pending state and reasons.

Pod in Pending Status

In K8s, the “Pending” status for a Pod means that the Pod has been accepted by the K8s system, but it hasn’t been scheduled for running on a node yet, or it has been scheduled but the necessary preparations are not complete.

For example:

# kubectl get pods --field-selector=status.phase=Pending

NAME                         READY   STATUS    RESTARTS   AGE
testing-pod                  0/1     Pending   0          5m11s

Common Reasons

How to Troubleshoot

Here are some steps you can take to troubleshoot Pods stuck in the Pending state:

# kubectl describe pod <pod-name> 

This command will provide a lot of useful information, such as the current state of the Pod, recent events, and so on.

Check for Events: At the bottom of the kubectl describe pod <pod-name> output, you’ll see an “Events” section. This section can often provide clues about why the Pod is not starting. Look for events like “FailedScheduling”, which can indicate issues like insufficient resources on your nodes or or some PaaS cluster, wont in-cooperate events with describe command, you may need to run,

# kubectl get events | grep <pod-name>

# kubectl logs <scheduler-pod-name> -n kube-system 
# kubectl -n kube-system logs $(kubectl -n kube-system get pods|grep scheduler|awk '{print $1}')
# kubectl describe node <node-name> 

Or Filter only the CPU details of all the node available on the cluster using

# kubectl describe nodes | grep 'Name:|Allocated' -A 5 | grep 'Name|cpu'

Look for the “Allocatable” and “Capacity” sections to see how much CPU and memory is available on the node.

watch our troubleshooting series,

Exit mobile version