Skip to content
Latchkey

kubectl drain "Cannot evict pod ... violate the disruption budget" in CI

A PodDisruptionBudget caps how many pods of a set may be unavailable at once. Your drain/eviction would push availability below that floor, so the eviction API refuses it - by design, to protect the workload.

What this error means

kubectl drain <node> stalls and repeats error when evicting pods/"<pod>" ... Cannot evict pod as it would violate the pod's disruption budget. The drain cannot complete while the PDB is at its limit.

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 already at its minimum

The PDB’s minAvailable/maxUnavailable is already satisfied with no slack, so evicting one more pod would breach it.

Not enough healthy replicas to allow disruption

Replicas are unhealthy or under-scaled, so there is no headroom for the PDB to permit an eviction.

How to fix it

Inspect the PDB and the replica health

See allowed disruptions before forcing anything.

Terminal
kubectl get pdb -A
kubectl describe pdb <pdb> -n <ns>   # ALLOWED DISRUPTIONS

Create headroom instead of bypassing the PDB

  1. Scale the workload up so the PDB has slack, then re-run the drain.
  2. Fix unhealthy replicas so they count toward availability.
  3. If a PDB is genuinely misconfigured (e.g. minAvailable equal to replicas), correct it with the owner.

How to prevent it

  • Size PDBs with slack relative to replica count so maintenance can proceed.
  • Keep replicas healthy so the PDB always has allowed disruptions.
  • Drain one node at a time and let evictions retry rather than forcing them.

Related guides

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