Technical Insight How-to Guide

Kubernetes Pod Disruption Budgets: Designing for High Availability

Learn how Kubernetes Pod Disruption Budgets control voluntary evictions, support safe node maintenance, and protect application availability without blocking cluster operations.

Kubernetes Pod Disruption Budgets: Designing for High Availability
On this page

High availability is not just about running multiple replicas. It is also about controlling what happens when the platform needs to move them.

Node maintenance, cluster upgrades, and autoscaler scale-down operations routinely evict pods. If too many replicas disappear at once, even a healthy, replicated application can become unavailable. Pod Disruption Budgets (PDBs) let application owners specify how much voluntary eviction their workloads can tolerate.

PDBs are useful safeguards, but they are not availability guarantees. A badly chosen budget can also block maintenance indefinitely. The objective is to balance application resilience with the cluster’s ability to operate.

What a Pod Disruption Budget Actually Protects

Kubernetes distinguishes between voluntary disruptions, such as draining a node through the Eviction API, and involuntary disruptions, such as node failure or kernel crashes.

EventDoes a PDB prevent it?Why
kubectl drain using evictionYes, subject to budgetDrain requests eviction through the Eviction API
Cluster maintenance using evictionUsuallyDepends on the maintenance mechanism
Cluster autoscaler scale-downGenerallyAutoscaler considers eviction constraints
Deployment rolling updateNoDeployment rollout strategy controls replacement
Node crash or hardware failureNoPDB cannot prevent an involuntary failure
OOM killNoContainer failure is not an API eviction
Direct pod deletionNoDeletion can bypass the Eviction API

A PDB does not create replicas, restart failed nodes, guarantee application readiness, or enforce quorum. It limits admission of voluntary evictions when the actor uses the Eviction API.

Choosing minAvailable or maxUnavailable

A PDB uses one of two mutually exclusive settings.

Keep a minimum number healthy

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: api-pdb
  namespace: production
spec:
  minAvailable: 3
  selector:
    matchLabels:
      app: api

With four expected replicas, this permits at most one healthy replica to be voluntarily evicted at a time, provided three remain healthy.

Limit the number unavailable

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: frontend-pdb
  namespace: production
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: frontend

For controller-managed workloads, maxUnavailable: 1 is often easier to maintain as replica counts change. It expresses an interruption budget relative to the controller’s expected replica count.

Do not set both fields in one PDB. Ensure the selector matches exactly the intended pods. In policy/v1, an empty selector matches every pod in the namespace, not zero pods.

Percentage rounding matters

Kubernetes rounds percentages up. For example, with five expected replicas:

  • minAvailable: 80% requires four healthy replicas.
  • maxUnavailable: 25% allows two unavailable replicas, because 25% of five rounds up to two.

This can be surprising for small replica counts. Use integers where exact disruption limits are important.

A Practical Stateless Application Example

Consider a web application with five replicas. The service can tolerate one unavailable instance during maintenance.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-frontend
  namespace: production
spec:
  replicas: 5
  selector:
    matchLabels:
      app: web-frontend
  template:
    metadata:
      labels:
        app: web-frontend
    spec:
      containers:
        - name: web
          image: registry.example.com/web-frontend:1.2.0
          ports:
            - containerPort: 8080
          readinessProbe:
            httpGet:
              path: /ready
              port: 8080
            periodSeconds: 5
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web-frontend-pdb
  namespace: production
spec:
  maxUnavailable: 1
  unhealthyPodEvictionPolicy: AlwaysAllow
  selector:
    matchLabels:
      app: web-frontend

The readiness probe matters: a pod that exists but cannot serve traffic should not be counted as healthy. AlwaysAllow helps operators drain nodes containing unhealthy pods without waiting indefinitely for those pods to recover. It does not override the budget for healthy pods.

The PDB and the Deployment’s rolling-update settings serve different purposes. The PDB protects eviction-based maintenance; maxSurge and maxUnavailable in the Deployment strategy govern rolling replacement.

Stateful Services Need Application-Aware Budgets

For databases and distributed systems, a replica count alone is not enough to determine a safe PDB.

A three-member quorum-based system often needs two members available for a majority. A candidate PDB might be:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: consensus-pdb
  namespace: database
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: consensus-service

But this is only an eviction constraint. It does not understand leadership, replication lag, data placement, or whether the remaining nodes can actually serve requests.

For Kafka, Redis, Elasticsearch, MySQL, and other stateful systems, choose budgets based on the application’s replication model and failure domains. Operator-managed workloads may already create and maintain PDBs; inspect those before adding your own. Avoid overlapping PDB selectors, which can make eviction behavior problematic.

A common operational error is to infer that a replication factor of three automatically makes losing any one pod safe. Partition placement, synchronization, and cluster health determine the real tolerance.

PDBs and Topology Spread Work Together

A PDB cannot compensate for placing all replicas on one node or in one failure domain.

Use scheduling controls to distribute workloads across nodes or availability zones:

topologySpreadConstraints:
  - maxSkew: 1
    topologyKey: kubernetes.io/hostname
    whenUnsatisfiable: DoNotSchedule
    labelSelector:
      matchLabels:
        app: web-frontend

For multi-zone clusters, topology.kubernetes.io/zone may be appropriate if the nodes have valid zone labels and sufficient capacity exists in each zone.

Combine PDBs with topology spread, appropriate replica counts, readiness probes, and adequate spare capacity. Otherwise, the budget may prevent eviction because Kubernetes cannot schedule healthy replacements.

Avoiding the Single-Replica Trap

Consider a single-replica application with:

spec:
  minAvailable: 1

Its disruption allowance will normally be zero. A standard node drain cannot evict its only healthy pod, potentially blocking maintenance.

If the application can tolerate downtime during maintenance, omit the PDB or explicitly allow eviction:

spec:
  maxUnavailable: 1

Neither choice makes the workload highly available. If downtime is unacceptable, redesign the application to run multiple functional replicas and validate its state-sharing behavior.

Similarly, a PDB requiring all replicas to remain healthy may be unsuitable for a workload that needs routine node replacement.

Unhealthy Pods and Eviction Policy

A pod can be running but not Ready. Such a pod may already be unable to serve requests, and preventing its eviction can obstruct recovery.

The unhealthyPodEvictionPolicy field provides two behaviors:

  • IfHealthyBudget (default): restricts eviction of unhealthy running pods according to the health budget conditions.
  • AlwaysAllow: permits eviction of unhealthy running pods even when the healthy disruption budget is exhausted.

For many production workloads, AlwaysAllow is a sensible operational choice, provided application recovery behavior has been tested.

spec:
  maxUnavailable: 1
  unhealthyPodEvictionPolicy: AlwaysAllow
  selector:
    matchLabels:
      app: api

This setting is supported on modern Kubernetes releases; confirm support on the target cluster version.

Inspecting PDBs Before Node Maintenance

Before draining a node, check the disruption budget and workload health:

kubectl get pdb -A
kubectl describe pdb api-pdb -n production
kubectl get pods -n production -l app=api -o wide

The most important PDB status fields are:

FieldMeaning
currentHealthyMatching pods currently considered healthy
desiredHealthyHealthy pods required by the budget
expectedPodsExpected matching pod count
disruptionsAllowedCurrently permitted voluntary evictions

For machine-readable inspection:

kubectl get pdb api-pdb -n production \
  -o jsonpath='{.status.currentHealthy}{" / "}{.status.desiredHealthy}{" healthy; allowed="}{.status.disruptionsAllowed}{"\n"}'

During a drain, watch the budget:

kubectl get pdb -n production --watch

A zero allowance is not always an incident. It means no additional voluntary eviction is currently permitted. Whether that is a problem depends on pending maintenance, replica health, and the application’s design.

When a Drain Gets Stuck

A blocked drain is often evidence that the budget is doing exactly what it was configured to do.

Start with:

kubectl get pdb -A
kubectl get pods -A -o wide --field-selector spec.nodeName=worker-1
kubectl describe pdb api-pdb -n production

Investigate these common causes:

  1. Too few healthy replicas relative to minAvailable.
  2. Replacement pods stuck Pending because of capacity, affinity, topology, or storage constraints.
  3. Readiness probes failing, so replicas do not count as healthy.
  4. A single-replica workload with a zero-disruption budget.
  5. An unhealthy pod that cannot be evicted under the current eviction policy.
  6. Conflicting or overlapping PDB selectors.

Do not make --disable-eviction the standard workaround. This makes kubectl drain delete pods instead of using the Eviction API, bypassing PDB protection. Use it only under an explicitly approved emergency procedure after understanding the availability impact.

Monitoring PDBs with Prometheus

Where kube-state-metrics is installed, PDB status can be observed using metrics such as:

kube_poddisruptionbudget_status_pod_disruptions_allowed
kube_poddisruptionbudget_status_current_healthy
  < kube_poddisruptionbudget_status_desired_healthy

A useful alert detects sustained budget violations rather than treating every zero-disruption allowance as a failure:

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: pdb-health
  namespace: monitoring
spec:
  groups:
    - name: pdb-health
      rules:
        - alert: PodDisruptionBudgetViolated
          expr: |
            kube_poddisruptionbudget_status_current_healthy
              < kube_poddisruptionbudget_status_desired_healthy
          for: 10m
          labels:
            severity: warning
          annotations:
            summary: "PDB {{ $labels.namespace }}/{{ $labels.poddisruptionbudget }} below desired health"

Validate that these metrics and labels are available in your monitoring stack. In OpenShift, consider the distinction between platform monitoring and user-workload monitoring when deploying Prometheus rules.

A PDB with zero allowed disruptions may be intentional; alert on it only when combined with relevant maintenance or workload-health signals.

OpenShift and Cluster Upgrade Considerations

On OpenShift, node maintenance and cluster upgrades interact with workload availability, Machine Config Pools, and machine lifecycle controllers.

Before an upgrade or planned worker replacement:

  • Inventory PDBs across application namespaces.
  • Identify workloads with disruptionsAllowed: 0.
  • Confirm replica readiness and scheduling capacity on remaining nodes.
  • Review operator-managed PDBs for stateful platform components.
  • Check storage attachment and recovery characteristics for pods using persistent volumes.
  • Verify the upgrade or drain mechanism respects eviction constraints.

For clusters with constrained worker capacity, a correctly configured PDB can expose a deeper issue: the cluster lacks enough spare resources to move workloads safely.

The solution may be additional capacity, different scheduling constraints, or application changes—not simply weakening the PDB.

Platform Engineering: Make Disruption Budgets a Standard

PDBs should be part of workload design, not an afterthought added when a cluster upgrade stalls.

A practical platform baseline includes:

Workload typeStarting approachImportant caveat
Stateless service, multiple replicasmaxUnavailable: 1Confirm remaining replicas handle load
Critical APIExplicit minAvailableAlign with capacity and service SLOs
Quorum-based serviceApplication-specific budgetVerify leader, quorum, and data safety
Operator-managed databaseUse operator-supported PDBAvoid conflicting policies
Single-replica applicationUsually no restrictive PDBHigh availability requires redesign

Platform teams can package these defaults into Helm charts, GitOps templates, or internal developer platform components. Policy checks can flag missing or obviously unsafe budgets, but should allow justified exceptions.

Test PDB behavior in staging with realistic node drains. A syntactically valid PDB is not proof that maintenance will complete or that the application will remain available.

Conclusion

Pod Disruption Budgets are a small Kubernetes resource with significant operational consequences.

They help protect replicated workloads during voluntary eviction, but they cannot prevent node failures, replace application-level resilience, or guarantee zero downtime. A budget that is too permissive can expose availability risk; one that is too restrictive can prevent routine maintenance and upgrades.

Effective high availability requires PDBs, healthy replicas, topology-aware scheduling, sufficient capacity, and tested recovery procedures working together.

For production Kubernetes and OpenShift platforms, the goal is to make safe disruption behavior predictable—and to ensure the cluster remains maintainable when workloads are under pressure.

Related Articles

Stay ahead

Get the latest insights.

Insights on cloud, AI and open source — delivered to your inbox.

Email subscriptions are coming soon.