Interview Prep/Kubernetes/Scheduling and Pending Pods

Pods are Pending with `node(s) didn't match pod topology spread constraints` even though one zone has lots of free capacity.

IntermediateTroubleshootingScheduling and Pending Pods
Answer

Likely causes → whenUnsatisfiable: DoNotSchedule with maxSkew: 1 across zones. If one zone has no room (or no nodes for this pool), placing more Pods in the other zones would exceed the skew, so they stay Pending.

Diagnose →

kubectl get pods -l app=web -o wide --no-headers | awk '{print $7}' | xargs -I{} kubectl get node {} -L topology.kubernetes.io/zone --no-headers | awk '{print $NF}' | sort | uniq -c
kubectl get nodes -L topology.kubernetes.io/zone

Fix → Add capacity in the starved zone (node group per AZ for Cluster Autoscaler), or relax to ScheduleAnyway, or raise maxSkew. Note that minDomains can force the scheduler to treat missing zones as having zero Pods.

Prevent → One autoscaling group per AZ (or Karpenter) so capacity can be added where the constraint needs it.

All Kubernetes questions Roadmap: Kubernetes core

More on Scheduling and Pending Pods