Interview Prep/Kubernetes/Scheduling and Pending Pods

A high-priority Pod preempted a batch Pod but is still Pending with `nominatedNodeName` set.

AdvancedTroubleshootingScheduling and Pending Pods
Answer

Likely causes → Preemption is not instant: victims get their full terminationGracePeriodSeconds to exit. If a victim has a long grace period, a stuck preStop hook or a PDB the scheduler had to violate on a best-effort basis, the preemptor waits. Another Pod may also take the freed space if it fits first.

Diagnose →

kubectl get pod critical-x -o jsonpath='{.status.nominatedNodeName}'
kubectl get pods --field-selector spec.nodeName=<node> | grep Terminating
kubectl get pod <victim> -o jsonpath='{.spec.terminationGracePeriodSeconds}'

Fix → Lower grace periods on preemptible batch workloads, fix hanging preStop hooks, and keep enough headroom so critical Pods do not depend on preemption.

Prevent → Use a low PriorityClass with preemptionPolicy: Never for nice-to-have workloads, and set sane grace periods.

All Kubernetes questions Roadmap: Kubernetes core

More on Scheduling and Pending Pods