Maintaining Availability During Node Drains: Choosing a Pod Disruption Budget Strategy
Learn how to use Kubernetes Pod Disruption Budgets (PDBs) to prevent application downtime during node drains and cluster upgrades, and how to avoid common configuration deadlocks.
08 May 2026, 10:10 UTC

The Problem: Unplanned Downtime During Planned Maintenance
\nWhen you perform a cluster upgrade or scale down a node pool via a cluster autoscaler, Kubernetes triggers a “voluntary disruption.” By default, the kubectl drain command attempts to evict all pods from a node. Without a defined strategy, Kubernetes may evict too many replicas of a critical service simultaneously, causing a temporary outage or performance degradation despite having a Deployment in place.
The goal is to ensure that a minimum number of healthy pods remain operational throughout the eviction process, preventing the infrastructure layer from accidentally taking down the application layer.
\n\nComparing Availability Strategies
\nWhile standard replica counts ensure availability during involuntary failures (like a hardware crash), they do not prevent the API server from evicting multiple pods during voluntary maintenance. You must decide between using a Pod Disruption Budget (PDB) or relying solely on replica distribution.
\n\n| Strategy | \nMechanism | \nProtection Scope | \nRisk | \n
|---|---|---|---|
| Replica Scaling | \nIncreasing replicas count | \n Involuntary failures (node crash) | \nNode drains can still evict all pods if they reside on one node. | \n
| PDB: minAvailable | \nAPI server rejects evictions if count drops below X | \nVoluntary disruptions (upgrades, drains) | \nCan block node drains if set too high. | \n
| PDB: maxUnavailable | \nAPI server rejects evictions if X pods are already down | \nVoluntary disruptions (upgrades, drains) | \nMay allow too many pods to drop if total count is low. | \n
Trade-offs and Decision Logic
\nChoosing between minAvailable and maxUnavailable depends on whether your priority is a guaranteed floor of capacity or a controlled ceiling of loss.
Use minAvailable when:
\n- \n
- You have a strict minimum capacity requirement to handle baseline traffic. \n
- You are using a percentage (e.g.,
minAvailable: 50%) to scale the budget automatically as you scale your Deployment replicas. \n
Use maxUnavailable when:
\n- \n
- You want to ensure that only a small fraction of your fleet is offline at once, regardless of the total size. \n
- You are managing a large-scale cluster where losing a fixed number of pods (e.g.,
maxUnavailable: 1) is safer than a percentage. \n
Critical Constraint: The Deadlock Risk
\nSetting minAvailable equal to your total replica count (e.g., 3 replicas, minAvailable: 3) creates a deadlock. Because the API server will refuse to evict any pod that would bring the count below 3, kubectl drain will hang indefinitely. This prevents cluster upgrades and requires manual deletion of the PDB or pods to resolve.
Implementation Example
\nConsider a service with 3 replicas. To ensure at least 2 pods are always running during a node upgrade, apply the following PDB. This requires cluster-admin permissions or a Role with create/patch permissions on policy/v1.PodDisruptionBudget.
# Define the PDB targeting pods with the label 'app=api-gateway'
cat <\n\nValidating the Budget
\nTo verify the PDB is functioning, you can simulate a node drain. Run these commands on a worker node hosting your pods:
\n\n- \n
- Check current status: Run
kubectl get pdb api-gateway-pdb. EnsureALLOWED DISRUPTIONSis 1 (since 3 are running and 2 are required). \n - First Eviction: Run
kubectl drain --ignore-pod-eviction. The first pod should be evicted successfully. \n - Second Eviction: Attempt to drain another node hosting a remaining pod. The API server should return an error stating that the eviction would violate the Pod Disruption Budget. \n
Limitations
\n- \n
- Involuntary Failures: PDBs provide zero protection against kernel panics, power loss, or hardware failure. They only govern the
Eviction API. \n - Controller Dependency: A PDB only works if a controller (like a Deployment or StatefulSet) is present to recreate the pod on a different node. If you use a standalone Pod, the PDB will block the drain, but the pod will never be replaced. \n
- Version Assumption: This guide assumes Kubernetes v1.21+ where
policy/v1is the stable API for PDBs. \n
Rollback
\nIf a PDB is blocking critical infrastructure maintenance, remove the budget to allow evictions to proceed:
\nkubectl delete pdb api-gateway-pdb0 replies
A thoughtful contribution can make all the difference. Be the first to share one.