# Pod disruption budget

## What it is

A Pod disruption budget is a Kubernetes object that limits how many selected
Pods can be voluntarily evicted at the same time. It gives a workload owner a
way to express how much availability the application should retain when an
operator or an automated process asks the cluster to evict Pods. A budget can
set a minimum available count or a maximum unavailable count.

The budget applies to requests that go through Kubernetes' Eviction API. A node
drain typically uses that API to move work away from the machine before
maintenance. When an eviction would violate a matching budget, the request can
be refused until enough selected Pods are healthy to proceed. The management
tool can wait or retry. The budget's selector and the scale of the selected
workload matter, because they determine whose Pods contribute to the
calculation.

Involuntary disruptions are a separate part of the availability problem. A node
crash can make Pods unavailable immediately. Those losses affect how much
additional disruption the budget permits, but the budget cannot prevent the
crash. Direct Pod deletion is also separate from a request made through the
Eviction API. Workload controllers have their own rolling-update settings, which
should support the same service goals. Review each path by which an instance can
leave service.

## Why it matters

A service may run with several replicas and still lose too much capacity during
ordinary maintenance. Imagine a node hosts two of three instances and a drain
tries to evict both. If the service needs two healthy instances for its usual
workload, letting both leave together can produce a visible problem. A budget
gives the cluster a way to allow progress while asking the drain to pause before
removing too much of that workload.

A budget can also make operations slower by design. A replacement Pod may need
time to start or may remain pending when no node has enough available resources.
The drain cannot proceed if the other Pods already leave too little
availability. This is useful information about a capacity limit, and somebody
needs to know how to act on it. Monitor outstanding evictions, scheduler events
and actual service capacity while maintaining the cluster.

Choose the setting from the consequence of losing replicas. Two healthy readers
of a stateless catalogue may have enough capacity for expected traffic. A
replicated writer may need enough members to maintain agreement before accepting
changes. The number in a budget should follow the workload's measured or
specified requirement. Placement across failure domains, capacity for
replacement and graceful shutdown all affect whether that requirement is met in
practice.

## What it looks like in practice

Take an illustrative service with three replicas and a budget requiring two to
remain healthy. Begin a planned drain for a node with one replica. The cluster
can accept the eviction if the budget still allows it. After the workload
replaces the Pod, its readiness becomes part of the budget status. Test another
eviction before that replacement is ready and confirm the result matches the
intended allowance. Use a workload and selector dedicated to the exercise.

Exercise a second situation where an unrelated node has already failed. Observe
how the reduced health changes what the drain can do to surviving Pods. The
application should continue meeting the availability required for safe work. The
operator should also be able to explain why maintenance is waiting. In many
applications an unavailable Pod that remains on a node creates a separate
operational issue. Kubernetes exposes an unhealthy Pod eviction policy that can
influence how the drain handles such instances.

Engineer's
[durable infrastructure case study](/portfolio/built-infrastructure-that-still-runs-years-later/)
describes designing infrastructure for continuing operation with relatively
little manual intervention. A workload disruption budget is one tool for
applying that kind of operating discipline in Kubernetes. The illustrative drill
turns a maintenance requirement into an observable result. A planned change can
continue when there is enough healthy service, and its refusal gives the team a
reason to fix capacity or the workload before proceeding.

## Where it goes wrong

A selector can cover the wrong Pods, or two budgets can overlap in a way that
prevents eviction. Check the budget status to confirm which Pods match the
selector and contribute to the calculation. Add a small policy or deployment
test when label conventions change. A budget that's correct for a Deployment
with three replicas may also need review if the workload's normal replica count
changes.

Percentages introduce rounding and can make a small population behave
differently from a larger one. Test the smallest supported replica count and a
point where a scaler might adjust it during maintenance. A budget that leaves no
room for ordinary disruption can block a drain, while a loose budget can allow
more loss than the service can sustain. Measure the real operation and decide
who can change the declared budget when the application is recovering.

Look at single-replica workloads explicitly. Requiring the only replica to stay
healthy can make routine eviction wait indefinitely. Check whether the workload
can run a temporary additional replica or whether a short interruption is an
accepted part of its maintenance. The owner can then choose a budget that makes
the cluster's behaviour match the documented responsibility.

Finally, practice failure and maintenance separately. A budget manages a portion
of voluntary eviction behaviour. The scheduler, the Service and the application
each have their own role in replacement, traffic admission and capacity. A
useful rehearsal includes a denied eviction, a successful replacement and a
situation where a real outage reduces redundancy. Publish the procedure in terms
an operator can confirm through the application's health and the cluster's
status.

## Further reading

- [Kubernetes workload disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
  Discusses the disruption model and where budgets apply.
- [Configuring a Pod disruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/).
  Explains selectors, rounding and unhealthy Pod eviction policies.
- [The Kubernetes Eviction API](https://kubernetes.io/docs/concepts/scheduling-eviction/api-eviction/).
  Describes how eviction requests are submitted and refused when a budget
  applies.

<https://engineer.company/glossary/pod-disruption-budget/>
