Day 43advancedMar 15, 2026

Protect Uptime During Maintenance with PodDisruptionBudgets

Without PDBs, a node drain can take down your entire application at once.

kubernetesreliabilitymaintenance
Share:

What

PodDisruptionBudgets (PDBs) ensure that a minimum number of pods remain available during voluntary disruptions like node drains, cluster upgrades, or autoscaler scale-downs. They tell Kubernetes how many pods can be safely taken offline at a time, preventing maintenance from accidentally causing an outage.

Why It Matters

When you run `kubectl drain` on a node for maintenance, Kubernetes evicts all pods on that node. If all your replicas happen to be on that node, your app goes down. PDBs prevent this by blocking evictions that would violate your availability requirements. They're essential for production workloads that must stay up during infrastructure changes.

Example

# Option A: Ensure at least 2 pods are always running
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-app-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: web-app

# Option B (alternative β€” use one or the other, not both):
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-app-pdb-maxunavail
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: web-app

# Check PDB status
kubectl get pdb

# Drain a node (PDB will be respected)
kubectl drain node-1 --ignore-daemonsets --delete-emptydir-data
yaml

Common Mistake

Setting minAvailable equal to the total replica count (e.g., minAvailable: 3 with 3 replicas). This makes it impossible for Kubernetes to evict any pod, completely blocking node drains and cluster upgrades.

Quick Fix

Set minAvailable to replicas minus 1, or use maxUnavailable: 1 instead. This allows one pod to be evicted at a time while keeping your app available. For critical services, use maxUnavailable as a percentage like 25%.

Key Takeaways

  • 1PDB = guaranteed availability during maintenance
  • 2minAvailable: minimum pods that must stay running
  • 3maxUnavailable: max pods that can be down at once
  • 4Don't set minAvailable = total replicas (blocks all drains)
  • 5Use maxUnavailable: 1 for safe, gradual evictions

Was this tip helpful?

Help us improve the DevOpsPath daily collection

Share: