drainready

Will this node drain?

PORT OF kubectl · NODE ip-10-0-3-17

Crane idle.

BAY 01

Know before you cordon

kubectl drain evicts pods through the Eviction API. If a PodDisruptionBudget allows 0 disruptions, the API answers 429 and drain retries forever, printing a message that names the pod, not the budget. Node upgrades stall for hours. drainready reads the same pods and budgets first and tells you which container is lashed down, and why.

Stow plan · drainready ip-10-0-3-17 · exit 1
BLOCKED  ip-10-0-3-17   9 pods: 5 ok, 1 wait, 0 need flag, 1 blocked, 2 skipped
   BLOCKED  shop/db-0          PDB shop/db allows 0 disruptions (healthy 2, needs 2, expected 2)
                               fix: minAvailable (2) equals the replica count (2): scale up first,
                                    or switch to maxUnavailable: 1
   WAIT     shop/web-7d9-x2k   2 pods of PDB shop/web are on this node but only 1 may go at once
CSC SAFETY APPROVED · MAX GROSS 1 BINARY · TARE 0 DEPS

Load it

go install github.com/Blackman99/drainready/cmd/drainready@latest
# or grab a single binary for linux / macOS / windows:
# https://github.com/Blackman99/drainready/releases

# as a kubectl plugin (krew-index submission pending):
kubectl krew install drainready
kubectl drainready NODE

drainready NODE                 # one node
drainready -l eks.amazonaws.com/nodegroup=old   # a whole node group
drainready --all --json         # every node, for CI / upgrade scripts
drainready --markdown NODE > ticket.md   # report for the change ticket
BAY 02

What the crane sees

  1. OK Eviction admitted now: no budget, or the budget has room.
  2. WAIT More pods of one budget sit on this node than may leave at once. Drain finishes, but only as replacements turn ready elsewhere.
  3. FLAG Bare pod or emptyDir: drain refuses without --force / --delete-emptydir-data.
  4. BLOCKED Budget at 0, overlapping budgets, maxUnavailable: 0, a budget its controller cannot compute (SyncFailed), or more node-pinned volumes than the budget allows. Drain hangs.

Exit codes: 0 ready · 1 blocked · 3 needs a flag · 2 error. Add --server-dry-run to have the API server confirm each eviction without evicting anything.