A node is to be drained for an update, but kubectl drain makes no progress and repeats the same line every five seconds. A PodDisruptionBudget forbids even one pod of the application from leaving the node.
Symptom
kubectl drain cp3 --ignore-daemonsets --delete-emptydir-data --timeout=20s evicting pod demo/shop-76d76f687d-8nsl7 error when evicting pods/"shop-76d76f687d-8nsl7" -n "demo" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget. error: unable to drain node "cp3" due to error: error when evicting pods/"shop-76d76f687d-8nsl7" -n "demo": global timeout reached: 20s, continuing command... There are pending nodes to be drained: cp3
Without --timeout, kubectl drain hangs here forever. With a time limit it gives up after 20 seconds and leaves the node cordoned.
Diagnosis
Look at the application's PDB – the ALLOWED DISRUPTIONS column is what matters.
kubectl -n demo get pdb shop NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE shop 2 N/A 0 80s
Causes
ALLOWED DISRUPTIONS 0minAvailable as high as the replica count
With minAvailable 2 and two pods, no pod may leave. An eviction would violate the budget, so the API rejects it and kubectl drain keeps retrying.
Pods not readyToo few healthy pods
Even a sensible PDB blocks when pods are not Ready right now: all allowed disruptions are already used up.
Fix
kubectl uncordon cp3
kubectl -n demo patch pdb shop --type=merge -p '{"spec":{"minAvailable":1}}'
Don't: Delete the PDB before every drain. Always keep minAvailable below the replica count or use maxUnavailable 1 – a PDB with minAvailable equal to the replicas is not protection, it is a blockade.
Kubernetes Day 2, Day 3: updates without downtime – readiness, preStop, PDBs and a drain that gets stuck.
Go to day 3 →
FAQ
Why does kubectl drain hang without an error?
Without --timeout, drain retries the rejected eviction every five seconds forever. Always set a time limit during maintenance.
minAvailable or maxUnavailable?
maxUnavailable 1 adapts to the replica count and never blocks completely as long as the pods are healthy.