kubectl-plugins

pending

Explain why pods are unschedulable: taints, insufficient CPU or memory, affinity.

Install kubectl-pending
curl -fsSL https://kubectl-plugins.dev/install.sh | sh -s -- pending
Download a binary insteadmacOS (Apple silicon) · macOS (Intel) · Linux (amd64) · Linux (arm64) · Windows (amd64)
Put the binary on your PATH as kubectl-pending, or build from source.
kubectl pending [-n NAMESPACE | -A] [-l SELECTOR]

Finds pods the scheduler could not place (phase Pending, no node assigned, PodScheduled=False with reason Unschedulable) and summarizes the scheduler’s message into a short cause plus the per-node reasons.

Causes

CauseMeaning
Insufficient cpu, Insufficient memory, …No node has enough of that resource free
TaintsNodes have taints the pod does not tolerate
NodeAffinityNode selector or node affinity matched no node
PodAffinityPod affinity, anti-affinity or topology spread rules cannot be met
CordonedNodes are marked unschedulable
VolumesPersistentVolumeClaim is unbound or volume node affinity conflicts
HostPortsRequested host ports are already in use
OtherAnything not recognized; see DETAIL

Flags

FlagDescription
-n, --namespaceNamespace to scan (default: current context namespace)
-A, --all-namespacesScan every namespace and add a NAMESPACE column
-l, --selectorOnly scan pods matching a label selector

Examples

kubectl pending
kubectl pending -A
kubectl pending -l app=web

Sample output

$ kubectl pending -A
NAMESPACE  NAME         AGE  CAUSE                                            DETAIL
ml         trainer-0    12m  Insufficient cpu,Insufficient memory,Taints      2 Insufficient cpu; 1 Insufficient memory; 2 node(s) had untolerated taint {dedicated: gpu}
web        web-6b7c-x4  3m   NodeAffinity                                     3 node(s) didn't match Pod's node affinity/selector

How to act on a cause:

CauseTypical fix
Insufficient ...Lower the pod’s requests, free capacity, or scale the node pool (kubectl np scale)
TaintsAdd a toleration, or use a node pool without the taint
NodeAffinityFix the nodeSelector or affinity rule, or label a node to match
CordonedUncordon the nodes (kubectl uncordon)
VolumesCheck the PVC is bound and in the same zone as the target nodes

Prints No unschedulable pods. when nothing is stuck. Pods that are scheduled but still starting (image pulls, init containers) are not shown; use unhealthy for those.