0
0
Kubernetesdevops~10 mins

Pod stuck in Pending state in Kubernetes - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Pod stuck in Pending state
Pod Created
Scheduler Checks Resources
Resources Available?
NoPod Stays Pending
Yes
Pod Scheduled to Node
Pod Starts Running
This flow shows how a pod moves from creation to running, or stays pending if resources are insufficient.
Execution Sample
Kubernetes
kubectl get pods
kubectl describe pod mypod
kubectl get nodes
kubectl describe node nodename
Commands to check pod status, details, and node resources to diagnose Pending state.
Process Table
StepActionCondition/CheckResultNext Step
1Pod created by userN/APod enters Pending stateScheduler checks resources
2Scheduler checks nodes for resourcesAre nodes free with enough CPU/memory?No nodes availablePod remains Pending
3User runs 'kubectl describe pod mypod'Check events for reasonsShows 'Insufficient cpu' eventUser checks nodes
4User runs 'kubectl get nodes'Check node status and capacityNodes Ready but CPU fully usedUser considers scaling or freeing resources
5User runs 'kubectl describe node nodename'Check detailed resource usageConfirms no free CPUPod stays Pending until resources free
6User frees resources or adds nodesResources become availableScheduler assigns pod to nodePod moves to Running state
7Pod starts runningPod status changesPod ReadyEnd
💡 Pod stays Pending if no nodes have enough free resources; moves to Running once scheduled.
Status Tracker
VariableStartAfter Step 2After Step 4After Step 6Final
Pod StatusPendingPendingPendingRunningRunning
Node CPU AvailabilityUnknownInsufficientInsufficientSufficientSufficient
Key Moments - 3 Insights
Why does the pod stay in Pending even though nodes are Ready?
Nodes can be Ready but still have no free CPU or memory. Execution table step 4 shows nodes are Ready but CPU is fully used, so pod cannot be scheduled.
What does the 'Insufficient cpu' event mean in pod description?
It means the scheduler tried to find a node with enough CPU but failed. See execution table step 3 where this event is found, indicating resource shortage.
How can the pod move from Pending to Running?
By freeing resources or adding nodes to increase available CPU/memory. Step 6 shows that once resources are sufficient, scheduler assigns the pod and it starts running.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the pod status change from Pending to Running?
AStep 2
BStep 6
CStep 4
DStep 3
💡 Hint
Check the 'Pod Status' variable in variable_tracker after Step 6.
According to the execution table, what is the main reason the pod stays Pending at Step 2?
ANo nodes have enough CPU resources
BNode is Not Ready
CPod configuration error
DNetwork issue
💡 Hint
See Step 2 'Result' column and variable_tracker 'Node CPU Availability' after Step 2.
If the user adds more nodes with free CPU, how will the pod status change in the variable_tracker?
APod Status remains Pending
BNode CPU Availability becomes Insufficient
CPod Status changes to Running
DPod Status changes to Failed
💡 Hint
Refer to Step 6 and final values in variable_tracker.
Concept Snapshot
Pod Pending State:
- Pod created but not scheduled yet
- Scheduler checks node resources
- Pending if no node has enough CPU/memory
- Check 'kubectl describe pod' for events
- Free resources or add nodes to schedule pod
- Pod moves to Running once assigned
Full Transcript
When you create a pod in Kubernetes, it starts in Pending state until the scheduler finds a node with enough resources. The scheduler checks all nodes for available CPU and memory. If no node has enough free resources, the pod stays Pending. You can use 'kubectl describe pod' to see events like 'Insufficient cpu' that explain why scheduling failed. Checking nodes with 'kubectl get nodes' and 'kubectl describe node' helps confirm resource availability. To fix Pending pods, free resources or add nodes. Once resources are sufficient, the scheduler assigns the pod to a node and it starts running.