Controlling Pod Termination with Kubernetes PDBs During Node Drains
How Pod Disruption Budgets protect workloads during node drains, with configuration steps, version notes, and verification commands.
22 Aug 2026, 07:53 UTC

Problem: Aggressive Pod Termination During Maintenance
\nWhen you run kubectl drain to upgrade a node or shift workloads, Kubernetes can terminate pods faster than is healthy for your application. Without guidance, a single node drain could ripple through your cluster, leaving insufficient replicas to serve traffic.
Thesis: Pod Disruption Budgets Give You Control
\nPod Disruption Budgets (PDBs) let you specify a minAvailable or maxUnavailable threshold per workload. The Kubernetes eviction logic respects that threshold during voluntary disruptions such as node drains, cluster autoscaling events, or manual edits.
What PDBs Guarantee (and What They Don't)
\n- \n
- PDBs operate at the workload level. After a disruption, at least
minAvailablepods must remain running. \n - They only apply to voluntary disruptions triggered by
kubectl drain, cluster autoscaling, or resource edits. They do not protect against evictions from PodSecurityPolicy removal,kube-systempod lifecycle events, or preemption-driven termination. \n - Setting
minAvailableto0effectively disables the safety net, allowing complete workload drain. \n
Configuring minAvailable and maxUnavailable
\nA typical PDB for a deployment with three replicas, allowing at most one pod to be evicted at a time:
minAvailable: 2 maxUnavailable: 1\n
Diagnostic Command
\nTo inspect an existing PDB and verify its fields, run:
kubectl get poddisruptionbudgets -A -o yaml\n
Where to run: Any machine with kubectl configured to talk to the target cluster.
Required permissions: core/v1/poddisruptionbudgets.get (or list) RBAC role. In most default setups, authenticated users can list PDBs across namespaces.
\nMeaningful placeholders: Replace -A with -n namespace to scope a single namespace, or target a specific budget with kubectl get poddisruptionbudget budget-name.
\nExpected checks: Look for the minAvailable and maxUnavailable fields under the spec section. Confirm that minAvailable is greater than 0 if you intend to prevent drain, and that the value aligns with your workload's replica count.
\nRelevant risks: A misconfigured minAvailable: 0 allows the entire workload to be drained, contradicting the availability guarantee. If your cluster uses pod priority and preemption, PDBs may interact poorly, potentially starving lower-priority pods during resource pressure.
\nVersion-Dependent Behavior and Cloud Provider Defaults
\nKubernetes 1.21 and newer releases include more stable PDB status fields, making it easier to verify which pods are available versus disrupted. Older releases may lack these refined fields, so upgrading is advisable if you rely on PDB status for automation.
\nManaged clusters such as GKE and EKS often pre-create PDBs for system workloads (for example, DNS, monitoring agents). These default PDBs cannot be deleted, only modified. If you're testing ad-hoc drain scenarios, verify whether a PDB is provider-enforced before attempting removal.
\nTrade-Off: Preemption, Priority, and the minAvailable=0 Trap
\nSetting minAvailable too low or to 0 defeats the purpose of the budget. Beyond misconfiguration, PDBs interact with the scheduler's preemption logic: if a pod has a low priority, the scheduler may preempt it first, but if a PDB protects that pod, the eviction may be deferred, creating a starvation scenario under sustained pressure.
\nPractical verification: after applying a PDB, simulate a drain on a node and watch pod lifecycles. Use kubectl get pods -w alongside kubectl drain --dry-run=client to observe behavior without immediate termination.
\nActionable Closing
\n- \n
- Inspect your workload's PDB: kubectl get poddisruptionbudgets -A -o yaml. Confirm minAvailable reflects your availability goal. \n
- If no PDB exists, create one aligned with your replica count. Example:
apiVersion: v1 kind: PodDisruptionBudget metadata: name: web-frontend-pdb namespace: production spec: minAvailable: 2 selector: matchLabels: app: web-frontend
\n - Apply it: kubectl apply -f web-frontend-pdb.yaml \n
- Verify the PDB is active: kubectl get poddisruptionbudget web-frontend-pdb -n production -o yaml \n
- Simulate a drain on a test node: kubectl drain --ignore-daemonsets --delete-emptydir-data --dry-run=client and observe that pods respect the minAvailable threshold before terminating. \n
Remember: PDBs are a safety net, not a guarantee against all failures. Pair them with health checks and careful rollout strategies for production resilience.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.