Kubernetes PodDisruptionBudgets Explained
A Kubernetes PodDisruptionBudget limits how many pods of an app can be voluntarily evicted at once, keeping it available during drains and upgrades.
A PodDisruptionBudget (PDB) is a Kubernetes object that limits how many pods belonging to an application can be taken down at the same time by voluntary disruptions — node drains, cluster upgrades, autoscaler scale-downs. You declare either a minimum number of pods that must stay available or a maximum number that may be unavailable, and the cluster’s eviction API refuses any eviction that would break that promise. PDBs are how you keep a replicated service serving traffic while the platform team replaces every node underneath it.
Voluntary vs involuntary disruptions
Kubernetes splits pod disruptions into two kinds, and PDBs only govern one of them.
Involuntary disruptions are things nobody chose: a node’s hardware fails, a kernel panics, a VM is lost, the node runs out of memory and the kubelet evicts pods under pressure. A PDB cannot prevent these. It can only make sure that you are not also doing voluntary disruptions on top of an outage.
Voluntary disruptions are actions initiated by a person or a controller:
kubectl drainbefore node maintenance or an OS patch- Managed node pool upgrades that cordon and drain nodes one at a time
- The cluster autoscaler removing an underused node
- Tools that rebalance pods across nodes
These go through the eviction API, and the eviction API consults PDBs. Deleting a pod directly or deleting its Deployment does not go through the eviction API, so PDBs do not block those operations.
Writing a PDB
A PDB has a label selector that picks the pods it protects and exactly one of two fields.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: web-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: web
Or, expressed the other way:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: web-pdb
spec:
maxUnavailable: 1
selector:
matchLabels:
app: web
Both fields accept an absolute number or a percentage, such as minAvailable: "50%". The selector should match the labels on the pods created by your Deployment or StatefulSet, and it should not overlap with another PDB’s selector — overlapping budgets make eviction decisions confusing and can block drains.
minAvailable vs maxUnavailable
minAvailable | maxUnavailable | |
|---|---|---|
| Meaning | At least this many pods must stay healthy | At most this many pods may be down |
| Scales with replica count | No (as an absolute number) | Yes, effectively |
| Risk when scaling down | Can block all evictions if replicas ≤ minAvailable | Still allows one eviction at a time |
| Typical use | Quorum-based systems needing a fixed minimum | Stateless services that scale up and down |
For most stateless services, maxUnavailable: 1 is the safer default. If an autoscaler later reduces the Deployment to 2 replicas, a minAvailable: 2 budget would forbid every eviction, and node drains would hang. maxUnavailable: 1 keeps working at any replica count above one.
For quorum-based systems — etcd, ZooKeeper, a Raft-replicated database — minAvailable set to the quorum size is clearer: with 5 members and a quorum of 3, minAvailable: 3 guarantees the cluster never loses a majority to maintenance. These usually run as StatefulSets.
How the eviction API enforces it
When a drain asks to evict a pod, the API server checks every PDB whose selector matches that pod. It looks at how many matching pods are currently healthy — running and passing their readiness checks — and compares that to the budget.
- If evicting the pod keeps the application within budget, the eviction succeeds and the PDB’s allowed-disruptions counter drops.
- If not, the API returns HTTP 429 (Too Many Requests).
kubectl drainwaits and retries until a replacement pod becomes healthy elsewhere and frees up budget.
This is why readiness probes matter so much. A PDB counts only ready pods as available. If a replacement pod is scheduled but its readiness probe is too lax, the budget is released before the pod can actually serve traffic. If the probe is too strict or the app is slow to start, drains stall for a long time.
You can see the current state with kubectl get pdb, which shows the minimum or maximum, the allowed disruptions right now, and how many pods are currently healthy.
Common mistakes
A budget that allows zero disruptions. maxUnavailable: 0, or minAvailable equal to the replica count, means no pod can ever be voluntarily evicted. Node drains block indefinitely, and managed upgrades may stall or eventually force-evict after a timeout. If you truly need zero downtime during maintenance, run more replicas instead.
A PDB on a single-replica app. With one replica, any meaningful budget blocks every drain. Either accept that the app will briefly go down during maintenance (and skip the PDB) or run at least two replicas.
Forgetting the pods are unhealthy already. If a crash-looping pod is one of the matching pods, it counts against availability, and the budget may permit no further evictions. Recent Kubernetes versions offer an unhealthyPodEvictionPolicy field; setting it to AlwaysAllow lets the eviction API remove pods that are already not ready, so a broken pod cannot block a drain.
Relying on a PDB for safe rollouts. A PDB does not control how a Deployment replaces pods during an update. That is governed by the Deployment’s own rolling update maxSurge and maxUnavailable settings, or by a progressive strategy like blue-green or canary deployments. PDBs only protect against evictions.
PDBs and graceful shutdown
A PDB decides whether a pod may be evicted. It does nothing about how the pod exits. Once eviction is allowed, the pod receives a termination signal and has its grace period to finish in-flight requests, close connections, and flush state. If the application ignores the signal, requests in flight are dropped even though the budget was respected. Pair every PDB with proper graceful shutdown handling and a sensible terminationGracePeriodSeconds.
It is also worth pairing PDBs with pod anti-affinity or topology spread constraints. A budget that allows one disruption at a time is little help if all your replicas landed on the same node, because a single drain — or a single hardware failure — takes them all out together.
PDBs and autoscaling
The cluster autoscaler respects PDBs when deciding whether a node can be removed. A node running a pod whose budget currently allows no disruptions will not be scaled down. That is usually what you want, but an overly strict PDB can keep underused nodes alive indefinitely and inflate costs. When tuning pod-level scaling with HPA or VPA, revisit the budget so it still makes sense at the minimum replica count.
The takeaway
A PodDisruptionBudget tells Kubernetes how much voluntary disruption an application can tolerate, and the eviction API enforces it during drains, upgrades, and autoscaler scale-downs. Use maxUnavailable: 1 for most stateless services, minAvailable set to quorum for consensus-based systems, and never write a budget that allows zero disruptions. Combine it with honest readiness probes, graceful shutdown, and replicas spread across nodes, and routine cluster maintenance stops being an outage risk.
Tagged
Keep reading
Chisato · · 4 min read Kubernetes Init Containers Explained
Init containers run to completion before a pod's main containers start, making them the standard way to handle setup steps and startup ordering.
Chisato · · 4 min read Kubernetes Service Types: ClusterIP vs NodePort vs LoadBalancer
Kubernetes offers four Service types for exposing pods on the network. How ClusterIP, NodePort, LoadBalancer, and ExternalName each route traffic.
Chisato · · 4 min read Helm vs Kustomize for Kubernetes Config
Helm templates and packages Kubernetes manifests with a templating language; Kustomize patches plain YAML declaratively, with no templates at all.