Interview Prep/Kubernetes/Scheduling and Pending Pods

A StatefulSet Pod `db-2` is Pending with `1 node(s) had volume node affinity conflict` after a node replacement.

IntermediateTroubleshootingScheduling and Pending Pods
Answer

Likely causes → Its PV is a zonal disk (EBS, PD) pinned to us-east-1a through PV nodeAffinity, and there is no schedulable node in that zone (node group shrank, zone has no capacity, or the Pod's own constraints exclude that zone's nodes).

Diagnose →

kubectl get pv $(kubectl get pvc data-db-2 -o jsonpath='{.spec.volumeName}') -o jsonpath='{.spec.nodeAffinity}' | jq
kubectl get nodes -L topology.kubernetes.io/zone

Fix → Add capacity in that zone (per-AZ node groups, or Karpenter with subnets in all zones). Do not delete the PVC unless you accept data loss; restore from a snapshot into another zone if the zone is gone.

Prevent → Per-AZ node groups for stateful pools, WaitForFirstConsumer binding, and replication at the application layer across zones.

All Kubernetes questions Roadmap: Kubernetes core

More on Scheduling and Pending Pods