Skip to content
Latchkey

kubectl drain "Cannot evict pod as it would violate the pod's disruption budget"

A PodDisruptionBudget caps how many pods of a set may be voluntarily disrupted at once. kubectl drain evicts pods, so when the PDB already has zero allowed disruptions, the eviction is refused and the drain stalls.

What this error means

kubectl drain <node> repeats evicting pod <ns>/<pod> then error when evicting pods ... Cannot evict pod as it would violate the pod's disruption budget and never completes. The node stays cordoned with pods still on it.

kubectl output
evicting pod prod/api-6c8f9d5b7c-h2k4p
error when evicting pods/"api-6c8f9d5b7c-h2k4p" -n "prod" (will retry after 5s):
Cannot evict pod as it would violate the pod's disruption budget.

Common causes

PDB has zero allowed disruptions

A minAvailable equal to the replica count (or maxUnavailable: 0) means no pod may be evicted. Any drain that would remove one is blocked to honor the budget.

Not enough healthy replicas to spare one

Even a permissive PDB blocks eviction when current healthy pods are already at the floor - e.g. one replica is already down, so evicting another would breach minAvailable.

How to fix it

Inspect the PDB and current disruptions allowed

See whether the budget genuinely allows an eviction right now.

Terminal
kubectl get pdb -n <ns>
kubectl get pdb <pdb> -n <ns> -o jsonpath='{.status.disruptionsAllowed}'; echo

Restore headroom so an eviction is allowed

  1. Scale the workload up (or wait for unhealthy pods to recover) so healthy replicas exceed minAvailable.
  2. Set a sane maxUnavailable/minAvailable that leaves at least one disruptable pod for rolling node ops.
  3. Then re-run kubectl drain - evictions proceed as the budget permits.

How to prevent it

  • Set PDBs that always leave at least one disruptable pod (e.g. maxUnavailable: 1 on multi-replica sets).
  • Run more than one replica for workloads protected by a PDB so drains can proceed.
  • Check disruptionsAllowed before automated node rotations in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →