Tune a PodDisruptionBudget minAvailable
Set a disruption budget that protects availability during drains without blocking voluntary disruptions entirely.
Task
Configure a PodDisruptionBudget that keeps enough replicas during node drains.
When to use this
A node drain hangs because the disruption budget requires all replicas to stay available.
Prerequisites
- A deployment with multiple replicas
- kubectl access
- An understanding of the availability target
Steps
1. Set a budget that leaves room to drain.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: app-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: apiExpected output: At least two replicas stay available while one can be disrupted at a time.
2. Verify a simulated drain respects the budget.
kubectl drain node-1 --ignore-daemonsets --delete-emptydir-data --dry-run=serverExpected output: The drain proceeds because the budget allows one disruption.
Troubleshooting
Problem
Drain still blocked
Solution
Ensure replicas exceed minAvailable so there is room for one disruption.
Problem
Rollout stalls with maxUnavailable 0
Solution
Reconcile the PDB with the deployment strategy so both can proceed.
Limitations
- PDB does not guarantee capacity, only disruption limits.
- Single-replica workloads cannot tolerate any disruption.
- Requires replicas above the budget.
What this recipe does
Configure a PodDisruptionBudget that keeps enough replicas during node drains.
A node drain hangs because the disruption budget requires all replicas to stay available.
Prerequisites
- A deployment with multiple replicas
- kubectl access
- An understanding of the availability target
Procedure
- Set a budget that leaves room to drain.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: app-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: api
Expected result: At least two replicas stay available while one can be disrupted at a time.
- Verify a simulated drain respects the budget.
kubectl drain node-1 --ignore-daemonsets --delete-emptydir-data --dry-run=server
Expected result: The drain proceeds because the budget allows one disruption.
How to confirm it worked
Run the commands above and confirm every expected result in order. If a step does not produce the stated output, use the troubleshooting notes before continuing. A passing run shows a node drain completes within the availability target while the budget keeps the required replicas serving.
Troubleshooting
Drain still blocked — Ensure replicas exceed minAvailable so there is room for one disruption.
Rollout stalls with maxUnavailable 0 — Reconcile the PDB with the deployment strategy so both can proceed.
Limitations
- PDB does not guarantee capacity, only disruption limits.
- Single-replica workloads cannot tolerate any disruption.
- Requires replicas above the budget.