Script Valley
Kubernetes: From Containers to Clusters
Security, RBAC, and Production ReadinessLesson 6.4

Kubernetes Pod Disruption Budgets: zero-downtime operations during cluster maintenance

PodDisruptionBudget resource, minAvailable, maxUnavailable, voluntary vs involuntary disruptions, node drain, eviction API, PDB and rolling updates interaction, unhealthy pod eviction policy

PDBs Protect Apps During Maintenance

Kubernetes Pod Disruption Budget enforcement diagram

When you drain a node for maintenance or an upgrade, Kubernetes evicts its Pods. Without a PodDisruptionBudget (PDB), all your app's Pods could be evicted simultaneously — downtime. A PDB tells Kubernetes the minimum number of Pods that must stay running during voluntary disruptions.

Creating a PDB

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-pdb
spec:
  minAvailable: 2         # at least 2 Pods must be running
  # OR:
  # maxUnavailable: 1     # at most 1 Pod can be down at once
  selector:
    matchLabels:
      app: web-app
# Drain a node (respects PDBs)
kubectl drain node-1 --ignore-daemonsets --delete-emptydir-data

# Check PDB status
kubectl get pdb
kubectl describe pdb web-pdb

PDB Limitations

PDBs only protect against voluntary disruptions (node drain, cluster upgrades, eviction API). They do not protect against involuntary disruptions — node hardware failure, OOM kill, kernel panic. Run at least 2 replicas across multiple nodes for true HA.

Up next

Kubernetes resource quotas and LimitRanges: enforcing multi-tenant cluster policies

Sign in to track progress