Pod Disruption Budget Strategies
Configure PodDisruptionBudgets for zero-downtime maintenance. MinAvailable vs maxUnavailable strategies for stateful workloads, GPU training.
π‘ Quick Answer: Use
maxUnavailable: 1for stateless services (allows one pod down during drain),minAvailable: "50%"for stateful workloads, andmaxUnavailable: 0for GPU training jobs that cannot tolerate any disruption.
The Problem
Node maintenance (upgrades, scaling, kernel patches) triggers pod evictions. Without PDBs, kubectl drain evicts all pods simultaneously β causing downtime. PDBs tell Kubernetes how many pods must remain available during voluntary disruptions.
The Solution
Strategy Matrix
| Workload Type | PDB Strategy | Value | Why |
|---|---|---|---|
| Stateless web service | maxUnavailable | 1 or 25% | Fast rollout, some degradation OK |
| Database / StatefulSet | minAvailable | "50%" | Quorum must be maintained |
| GPU training job | maxUnavailable | 0 | Cannot tolerate any pod loss |
| Single-replica critical | minAvailable | 1 | Must always be running |
| Batch processing | No PDB needed | β | Jobs are restartable |
Stateless Service
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: web-pdb
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web-frontendStateful Quorum (etcd, Kafka, ZooKeeper)
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: etcd-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: etcdFor a 3-node etcd cluster: minAvailable: 2 ensures quorum (majority) is always maintained.
GPU Training β No Disruption
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: training-pdb
spec:
maxUnavailable: 0
selector:
matchLabels:
app: distributed-trainingβ οΈ
maxUnavailable: 0blockskubectl drainentirely until the training job completes. Use withunhealthyPodEvictionPolicy: AlwaysAllow(K8s 1.31+) to still evict crash-looping pods.
graph TD
DRAIN[kubectl drain node] --> PDB{Check PDB}
PDB -->|maxUnavailable: 1<br/>0 currently unavailable| EVICT[Evict 1 pod]
PDB -->|maxUnavailable: 0| BLOCK[Block eviction<br/>Wait for completion]
PDB -->|minAvailable: 2<br/>3 currently available| EVICT
PDB -->|minAvailable: 2<br/>2 currently available| BLOCK
EVICT --> RECHECK{Re-check PDB}
RECHECK -->|Budget allows| EVICT
RECHECK -->|Budget exhausted| WAIT[Wait for pods<br/>to become ready]Common Issues
kubectl drain hangs forever
PDB with maxUnavailable: 0 or minAvailable equal to current replicas blocks all evictions. Use --timeout flag or temporarily adjust the PDB.
PDB blocks cluster autoscaler scale-down
Same issue β autoscaler respects PDBs. Ensure at least one pod can be disrupted for scale-down to work.
PDB selector doesnβt match any pods
Verify labels match: kubectl get pods -l app=web-frontend should return the pods you expect.
Best Practices
- Every production Deployment should have a PDB β no exceptions
- Use
maxUnavailablefor stateless β simpler, allows percentage-based scaling - Use
minAvailablefor stateful β directly expresses quorum requirement - Never set
minAvailable= replicas β blocks all voluntary disruptions - Combine with
topologySpreadConstraintsβ spread pods across nodes so draining one node doesnβt violate PDB
Key Takeaways
- PDBs protect against voluntary disruptions only (node drain, cluster autoscaler) β not involuntary (OOM, hardware failure)
maxUnavailable: 1is the safest default for most servicesmaxUnavailable: 0blocks all evictions β use for jobs that cannot restartminAvailablewith absolute numbers is safer than percentages for small replica counts- PDBs donβt prevent scaling down replicas β only pod evictions

Recommended
Kubernetes Recipes β The Complete Book100+ production-ready patterns with detailed explanations, best practices, and copy-paste YAML. Everything in one place.
Get the Book βLearn by Doing
CopyPasteLearn β Hands-on Cloud & DevOps CoursesMaster Kubernetes, Ansible, Terraform, and MLOps with interactive, copy-paste-run lessons. Start free.
Browse Courses βπ Deepen Your Skills β Hands-on Courses
Courses by CopyPasteLearn.com β Learn IT by Doing
