November 23, 2026 路 #68
The node that would not drain
A node upgrade stalls because kubectl drain keeps retrying to evict the checkout pods. Which line is responsible?
apiVersion: apps/v1
kind: Deployment
metadata:
name: checkout
spec:
replicas: 3
selector:
matchLabels: { app: checkout }
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: checkout
spec:
minAvailable: 3
selector:
matchLabels: { app: checkout }Next puzzle in UTC
One try. The first answer sticks.
How to fix it
With 3 replicas and minAvailable: 3, the budget allows 0 disruptions. Every eviction request is rejected, so kubectl drain retries forever. Use minAvailable: 2 or maxUnavailable: 1.
A PodDisruptionBudget (PDB) limits how many pods of an application can be taken down by voluntary disruptions such as kubectl drain, node upgrades, and cluster autoscaler scale-downs. Drain uses the Eviction API, and the API server refuses an eviction when it would push the application below the budget.
Here the Deployment runs three replicas and the PDB demands three available. The number of allowed disruptions is currentHealthy - minAvailable = 0, so every eviction fails with "Cannot evict pod as it would violate the pod's disruption budget". kubectl drain keeps retrying, and your node upgrade or autoscaler scale-down never finishes. A single unhealthy pod makes it worse, because you are then already below the budget.
Check it with kubectl get pdb checkout: the ALLOWED DISRUPTIONS column shows 0.
Fix
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: checkout
spec:
maxUnavailable: 1
selector:
matchLabels:
app: checkout
maxUnavailable: 1 (or minAvailable: 2) lets nodes drain one pod at a time while the service stays up. Keep the budget below the replica count, and make sure the Deployment has more than one replica, or a PDB with minAvailable: 1 will block drains for it too.