Have you ever experienced unexpected application downtime during a Kubernetes upgrade or routine maintenance?
If yes, you are not alone and fortunately, Kubernetes has a built-in feature to help: Pod Disruption Budgets (PDBs).
In this post, we will explore what PDBs are, why they matter, and how to implement them to keep your workloads resilient and available.
A PodDisruptionBudget (PDB) is a Kubernetes policy that ensures a certain number or percentage of pods remain available during voluntary disruptions.
Kubernetes supports two types of disruptions:
Voluntary Disruptions: Planned operations initiated by admins or automation, such as:
Node maintenance (e.g., upgrades or scaling down)
Cluster autoscaler removals
Pod eviction due to scheduling constraints
Involuntary Disruptions: Unplanned events like hardware failures, OS crashes, or network issues (PDBs do not cover these).
A PDB limits the number of pods that can be disrupted at a time for a given application.
This ensures service availability even during planned operations.
Pod Disruption Budgets are especially useful for stateful or critical applications where availability is paramount.
Maintains availability during cluster maintenance.
Prevents downtime caused by rolling updates or node drains.
Improves resilience and end-user experience.
Enforces SLA/SLO compliance.
Coordinates better with cluster autoscaler or drain scripts.
PDBs are defined as Kubernetes objects using YAML.
Explanation:
minAvailable: 3 ensures at least 3 pods stay running.
matchLabels links the PDB to the right pods (in this case, app=my-app).
You can also use maxUnavailable to define how many pods can be disrupted, instead of how many must remain.
This means no more than 1 pod can be disrupted at once.
Note: You can use either minAvailable or maxUnavailable — not both.
Here are some tips to use PDBs effectively:
Always define PDBs for critical deployments (like APIs, databases, or stateful services).
Avoid over-constraining with minAvailable equal to total pod count — it may block updates.
Test PDB behavior during updates using kubectl drain or simulated disruptions.
Combine with PodAntiAffinity and Readiness Probes for even stronger guarantees.
Monitor eviction failures or blocked disruptions to tune PDBs over time.
Kubernetes offers powerful self-healing and orchestration features but availability is your responsibility too. Pod Disruption Budgets (PDBs) give you the control to maintain uptime, even during maintenance windows or rolling updates.
If you are running production grade applications, adding a well-defined PDB is a must have best practice.