The drain that hangs
This story was written with the assistance of an AI writing program.
A node drain hangs mid-upgrade. The pods refuse to leave. Is Kubernetes stuck?
A PodDisruptionBudget can be doing exactly what you asked it to.
Kubernetes splits disruptions in two:
Involuntary - node crashes, hardware failures, out-of-resource eviction. A PDB cannot prevent these; they still count against the budget.
Voluntary - kubectl drain, node upgrades, cluster scale-down. Tools that respect budgets go through the eviction API, which checks the PDB first.
A PDB sets minAvailable or maxUnavailable for the pods its selector matches. When evicting one more pod would break the budget, the eviction is rejected and drain keeps retrying until its timeout.
Two catches worth knowing:
Deleting a pod or deployment directly bypasses PDBs completely. Only eviction-API users like drain are checked.
Set maxUnavailable: 0 (or minAvailable equal to your replica count) and drain can't evict any matching pod while the budget stays that tight. That is permitted behavior, not a bug.
Check yours:
kubectl get pdb The ALLOWED DISRUPTIONS column shows how many matching pods can be evicted right now. Zero means those pods can't be evicted.
Takeaway: a hanging drain can be a budget protecting your availability. Add capacity or fix the budget - don't delete the PDB to unblock the drain.
原文:https://www.a8q9.cn/en/article/the-drain-that-hangs-2f0eee.html