Skip to content

Pod stuck in Pending: why the scheduler finds no node

Kubernetestested on RKE2 v1.37.2

Pending means: the Pod exists but is not assigned to a node. The scheduler writes the reason as a FailedScheduling event on the Pod – with a reason for every node. The counts per reason add up to the number of nodes.

Symptom

kubectl -n tag03 get pods
NAME                     READY   STATUS    RESTARTS   AGE
gross-67c948f4bc-f8r7z   0/1     Pending   0          5s

No container, no logs, no restarts: a Pending Pod has never started. The answer is in the events, not in the status.

Diagnosis

Read the Pod's events. The message gives a reason for every node.

kubectl -n tag03 describe pod -l app=gross | sed -n '/^Events/,$p'
Events:
  Type     Reason            Age   From               Message
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  5s    default-scheduler  0/3 nodes are available:
  3 Insufficient cpu. preemption: 0/3 nodes are available: 3 Preemption is not
  helpful for scheduling.

Causes

Insufficient cpuRequests larger than any node

No node has 6 CPUs to hand out; the largest has 4. The scheduler works with requests, not with actual load – requests already reserved by system Pods count too.

kubectl get nodes -o custom-columns=NAME:.metadata.name,\
CPU:.status.allocatable.cpu,MEM:.status.allocatable.memory
NAME      CPU   MEM
cp1       4     12248236Ki
worker1   2     4009840Ki
worker2   2     4009840Ki

untolerated taint(s)nodeSelector points to a tainted node

One node matches the selector but has a taint; the others don't match the selector. The Pod lacks the toleration. A toleration only allows the node – the nodeSelector is what pulls the Pod there.

4s          Warning   FailedScheduling   Pod/batch-78ccfd557-7rrn6   0/3 nodes are
  available: 1 node(s) had untolerated taint(s), 2 node(s) didn't match Pod's node
  affinity/selector. preemption: 0/3 nodes are available: 3 Preemption is not
  helpful for scheduling.

unbound immediate PVCsPVC without a StorageClass

The PVC names no StorageClass, and the cluster has no default StorageClass. The message on the Pod is misleadingly terse; the real answer is on the PVC.

kubectl -n tag03 describe pvc daten | sed -n '/^Events/,$p'
Events:
  Type    Reason         Age              From                         Message
  ----    ------         ----             ----                         -------
  Normal  FailedBinding  1s (x2 over 7s)  persistentvolume-controller  no persistent
  volumes available for this claim and no storage class is set

No eventsThe scheduler doesn't exist

No FailedScheduling means no scheduler has looked at the Pod at all. Here it asks via schedulerName for a scheduler that doesn't exist in the cluster. A cluster whose scheduler is down looks the same.

kubectl -n tag03 events --for pod/still
No events found in tag03 namespace.
kubectl -n tag03 get pod still -o jsonpath='{.spec.schedulerName}{"\n"}'
batch-scheduler

Fix

Fix the reason the message names: lower the requests, add the toleration, set the StorageClass on the PVC. schedulerName is immutable – there the only way is to delete and recreate the Pod.
kubectl -n tag03 set resources deploy/gross --requests=cpu=500m
kubectl -n tag03 rollout status deploy/gross
kubectl -n tag03 get pods -l app=gross -o wide | cut -c1-80
NAME                     READY   STATUS    RESTARTS   AGE   IP           NODE   NOMINA
gross-6879f5c758-fqfbj   1/1     Running   0          2s    10.42.0.19   cp1    <none>

Don't: Looking at actual utilisation. The scheduler works with requests – a nearly idle node can be full as far as it is concerned.

▶
Break it yourself and find it – free
Debugging Kubernetes, day 3: five reasons for Pending from oversized requests to a ResourceQuota, with a drill to reproduce each one.
Go to day 3 →

FAQ

The Deployment shows 0/2, but there is no Pod at all?

An admission check rejected the Pods, for example a ResourceQuota or a LimitRange. The event is then on the ReplicaSet, not on the Pod.

What does "preemption … not helpful" mean?

Even evicting lower-priority Pods would not be enough. Otherwise, with PriorityClasses, the scheduler could make room.

Related error patterns

More