How to Fix a Kubernetes Pod Stuck in Pending
A pod stuck in Pending means the Kubernetes scheduler looked at every node and found none that matched. The scheduler records the exact rejection reason in Events - you just need to know where to look.
Why pods get stuck in Pending
When you create a Deployment or Pod, the scheduler tries to place it on a node. If no
node satisfies all of the pod's constraints - nodeSelector, affinity rules, taints,
or resource requests - the scheduler skips it silently. The pod stays in Pending
indefinitely and no log message tells you why.
The rejection reason is in the Events section of kubectl describe pod, not in kubectl
get pods. That's where to start every time.
Step 1: confirm the pod is Pending and read the Events
kubectl get pods
# NAME READY STATUS RESTARTS AGE
# web-7d9f5b8c4-xk2qp 0/1 Pending 0 3m
kubectl describe pod -l app=web
Scroll to the Events section at the bottom of the output. The scheduler logs a line for every node it rejected:
Events:
Warning FailedScheduling 3m default-scheduler
0/2 nodes are available: 2 node(s) didn't match Pod's node affinity/selector.
This tells you the pod has a nodeSelector or affinity rule that no node satisfies.
Step 2: check what labels the nodes actually have
kubectl get nodes --show-labels
Compare the output to the nodeSelector in your Deployment manifest:
spec:
template:
spec:
nodeSelector:
disktype: ssd # <- no node has this label
If no node carries disktype=ssd, the pod can never be placed. Either remove the
selector entirely or change it to a label that actually exists on a node.
Step 3: fix the manifest and re-apply
Remove (or correct) the impossible selector, then apply:
spec:
template:
spec:
# nodeSelector removed - pod can now land on any node
containers:
- name: web
image: nginx:stable
kubectl apply -f deployment.yaml
kubectl rollout status deployment/web
Within seconds the scheduler places the pod and rollout status completes.
Other common Pending causes
The Events section names every root cause - the fix follows from what it says:
- Taints without tolerations - a node is tainted
key=value:NoSchedulebut the pod has no matchingtolerations:block. Add one or remove the taint. - Resource requests too large -
requests.memory: 64Gion a 16 Gi node. Lower the request or add a bigger node. - PVC not bound - the pod mounts a PersistentVolumeClaim that's still
Pending. Fix the PVC first; the pod schedules once it binds. - Too-strict anti-affinity -
requiredDuringSchedulingIgnoredDuringExecutionrules that can't be satisfied given how many nodes you have.
In every case the Events message is specific. Reading it first saves the guesswork.
Want to try it hands-on? HeyDevJob gives you this exact setup in a live cloud workspace in your browser - edit it, run it, and see it work. Free, nothing to install.
Try it in a workspace →What you'll practice
- Reading scheduler rejection reasons from kubectl describe pod Events
- Comparing nodeSelector labels against kubectl get nodes --show-labels
- Removing an impossible nodeSelector and re-applying the Deployment
FAQ
Why is my Kubernetes pod stuck in Pending?
The scheduler couldn't find a node that satisfied all of the pod's constraints - nodeSelector, affinity rules, taints, or resource requests. Run kubectl describe pod and read the Events section; the scheduler logs the exact rejection reason there.
How do I find why a pod is Pending in Kubernetes?
Run kubectl describe pod <pod-name> and look at the Events section at the bottom. The scheduler records a line like '0/2 nodes are available: 2 node(s) didn't match Pod's node affinity/selector' that tells you exactly what rule failed.
What does 'didn't match Pod's node affinity/selector' mean in Kubernetes?
The pod's nodeSelector or nodeAffinity requires a label that no node in the cluster has. Run kubectl get nodes --show-labels to see what labels exist, then remove or correct the nodeSelector in your Deployment manifest.
Why is my pod stuck in Pending?
Pending means the scheduler cannot place the pod: not enough CPU/memory on any node, a nodeSelector or taint no node satisfies, or an unbound PersistentVolumeClaim. kubectl describe pod shows the exact reason in Events.
Keep learning
Learn it by doing. Open this in a live cloud workspace, make the change yourself, and keep a record of the work you can share.
Open the workspace →