Pod Disruption Budgets (PDBs) limit the number of pods that can be simultaneously unavailable during voluntary disruptions like node drains, cluster upgrades, or rolling deployments.Documentation Index
Fetch the complete documentation index at: https://docs.shiftlabs.dev/llms.txt
Use this file to discover all available pages before exploring further.
Key Concepts
PDB
Selector
Budget
Disruptions Allowed
Required Permissions
| Action | Permission |
|---|---|
| View PDBs | iam:project:infrastructure:kubernetes:read |
| Create PDB | iam:project:infrastructure:kubernetes:write |
| Edit PDB | iam:project:infrastructure:kubernetes:write |
| Delete PDB | iam:project:infrastructure:kubernetes:delete |
PDB Status Values
| Status | Description |
|---|---|
| Allowed | Disruptions are allowed (disruptionsAllowed > 0) |
| Blocked | No disruptions allowed (disruptionsAllowed = 0) |
How to View PDBs
How to View PDB Details
Review Details
- Overview: Name, namespace, status, age
- Budget: minAvailable or maxUnavailable setting
- Pod Counts: currentHealthy, desiredHealthy, expectedPods, disruptionsAllowed
- Selector: Label selector matching protected pods
- Conditions: PDB controller conditions
- Labels & Annotations: Metadata attached to the PDB
How to Create a PDB
Write YAML
spec.selector- Label selector for target podsspec.minAvailable- Minimum pods that must be available (integer or percentage)spec.maxUnavailable- Maximum pods that can be unavailable (integer or percentage)
How to Edit a PDB
Modify Spec
- Adjust minAvailable or maxUnavailable values
- Update selector labels
- Modify metadata
How to Delete a PDB
Budget Types
PDBs support two mutually exclusive budget specifications:minAvailable
Specifies the minimum number of pods that must remain available:maxUnavailable
Specifies the maximum number of pods that can be unavailable:| Field | Type | Description |
|---|---|---|
| minAvailable | int or % | Minimum pods that must remain available |
| maxUnavailable | int or % | Maximum pods that can be unavailable at once |
Pod Counts Explained
| Field | Description |
|---|---|
| expectedPods | Total number of pods selected by the PDB |
| currentHealthy | Number of pods currently in healthy/ready state |
| desiredHealthy | Minimum healthy pods required by the budget |
| disruptionsAllowed | How many pods can currently be disrupted |
disruptionsAllowed = currentHealthy - desiredHealthy
disruptionsAllowed is 0, voluntary disruptions are blocked until more pods become healthy or the budget is modified.Troubleshooting
Node drain is stuck waiting
Node drain is stuck waiting
- Check if a PDB is blocking the drain (disruptionsAllowed = 0)
- Verify pods are healthy and ready
- Scale up the deployment temporarily to allow disruption
- Consider using
kubectl drain --disable-evictionfor emergencies (bypasses PDB)
PDB shows 0 expected pods
PDB shows 0 expected pods
- Verify the selector matches your pod labels
- Check pods exist in the same namespace as the PDB
- Use
kubectl get pods --selector=<labels>to verify selector
Cannot create PDB - validation error
Cannot create PDB - validation error
- Ensure you specify either minAvailable OR maxUnavailable, not both
- Percentage values must be strings with % suffix (e.g., “50%”)
- Integer values must be non-negative
- Selector must be valid label selector syntax
Disruptions allowed is negative
Disruptions allowed is negative
- This means fewer pods are healthy than required by the budget
- Check pod health and resolve any pod failures
- The budget is currently being violated - no disruptions will be allowed
PDB not protecting pods during deployment
PDB not protecting pods during deployment
- PDBs only protect against voluntary disruptions (node drain, delete)
- Rolling update strategy is separate from PDB
- Configure maxUnavailable in Deployment spec for rolling updates
- PDBs don’t prevent involuntary disruptions (node failure, OOM)
Cluster upgrade blocked by PDB
Cluster upgrade blocked by PDB
- PDBs can block node upgrades if pods can’t be evicted
- Ensure replicas > minAvailable to allow rolling evictions
- Consider temporarily relaxing the PDB during maintenance
- Scale up workloads before upgrades to allow eviction headroom
FAQ
What are voluntary vs involuntary disruptions?
What are voluntary vs involuntary disruptions?
Should I use minAvailable or maxUnavailable?
Should I use minAvailable or maxUnavailable?
Can I have multiple PDBs for the same pods?
Can I have multiple PDBs for the same pods?
Do PDBs affect rolling deployments?
Do PDBs affect rolling deployments?
What happens if minAvailable equals replicas?
What happens if minAvailable equals replicas?
Can PDBs use percentage values?
Can PDBs use percentage values?
What is the difference between policy/v1beta1 and policy/v1?
What is the difference between policy/v1beta1 and policy/v1?
policy/v1 is the stable API (Kubernetes 1.21+) and should be used. policy/v1beta1 is deprecated. The main difference is that v1 has an empty selector behavior change.Do PDBs work with StatefulSets?
Do PDBs work with StatefulSets?