The PDB that looks stale but never lets a drain finish
The symptom
You drain a node. One pod never leaves. Depending on the budget's history, kubectl drain either repeats Cannot evict pod as it would violate the pod's disruption budget, or prints evicting pod ... and then nothing at all. The budget looks harmless: maxUnavailable: 1, and every pod it selects is Ready. Nothing is unhealthy, nothing overlaps, and yet kubectl get pdb shows ALLOWED DISRUPTIONS 0.
What is going on
To turn maxUnavailable (or a percentage minAvailable) into a number, the disruption controller needs the expected replica count. It follows each selected pod's controller owner reference and reads that owner's scale subresource. Deployments, ReplicaSets and StatefulSets have one. Many operator CRDs do not.
When the lookup fails, the controller takes its fail-safe path. It sets disruptionsAllowed to 0 and adds a condition:
status:
disruptionsAllowed: 0
conditions:
- type: DisruptionAllowed
status: "False"
reason: SyncFailed
message: widgets.example.com does not implement the scale subresource
The Eviction API answers every request with 429, and kubectl drain treats 429 as "try again later", so it retries forever. A managed node-group upgrade waits until its own timeout.
The trap: it looks "stale"
The fail-safe path does not record status.observedGeneration. For a budget that has never synced, observedGeneration stays below metadata.generation. That is exactly how a budget looks in the few seconds after you edit it, before the controller catches up. Any tool that reads it as "status not processed yet, try again" predicts a short wait. drainready did that too, until this week.
It also explains the silent drain. For a budget the server considers unprocessed, the Eviction API answers 429 with a Retry-After header, and client-go retries those responses on its own before kubectl sees an error. In our kind test, kubectl drain --dry-run=server --timeout=10s printed evicting pod ops/widget-0 and then nothing for 20 seconds, until the test killed it.
How to check by hand
kubectl get pdb -A -o jsonpath='{range .items[*]}{.metadata.namespace}/{.metadata.name}{"\t"}{.status.conditions[?(@.reason=="SyncFailed")].message}{"\n"}{end}' | awk -F'\t' '$2!=""'
Every line printed is a budget that blocks all voluntary evictions of its pods until it is fixed.
Fixes
- Use an integer
minAvailable. The controller counts the selected pods directly and needs no scale lookup. - Give the CRD a
/scalesubresource (subresources.scalein the CRD spec) so the controller can read the replica count. - Narrow the selector so the budget only covers pods from controllers that have a scale subresource.
Before you cordon
drainready now checks the DisruptionAllowed condition before it trusts observedGeneration (on main today, in the next release). It reports these pods as BLOCKED, quotes the controller's message, and gives the fix:
$ drainready ip-10-0-3-17
BLOCKED ip-10-0-3-17 7 pods: 4 ok, 0 wait, 0 need flag, 1 blocked, 2 skipped
BLOCKED ops/widget-0 PDB ops/widget cannot be computed by the disruption controller (SyncFailed: ...), so it allows 0 disruptions
fix: maxUnavailable and percentage minAvailable need every selected pod to belong to a controller with a scale subresource ...
CI reproduces this case on a real kind cluster, with a pod owned by a ConfigMap, and cross-checks the prediction with kubectl drain --dry-run=server. Add --markdown to get a report you can paste into the change ticket.