Pod Disruption Budgets in Kubernetes

Pod Disruption Budgets in Kubernetes

A clear, step-by-step guide to the safety rule that stops planned maintenance, upgrades, and scale-downs from taking too many copies of your application offline at the same time.

Picture a hospital with ten nurses on the night shift. At midnight, the manager announces that every nurse must attend a short training session. If all ten walk out together, the wards are empty for an hour, even though nobody did anything wrong and the training was a good idea. A wise manager sends two nurses at a time and makes sure that at least eight are always on the floor. The training still happens. The patients are still safe.

Kubernetes faces the same problem every day. Machines need to be updated, restarted, replaced, and removed. Each time, the applications running on those machines must be moved elsewhere. If the cluster moves too many copies of one application at once, users see errors, even though every action was planned and polite. A Pod Disruption Budget, usually shortened to PDB, is the rule that says: “No matter what maintenance is happening, always keep at least this many copies alive.”

In this guide you will learn what a Pod Disruption Budget is, how Kubernetes checks it, which events respect it and which ignore it, how to choose good numbers, and how to avoid the classic traps that make upgrades hang for hours. No earlier knowledge of the topic is needed. Every new word is explained the first time it appears, and there is no code to copy. Instead, you will get pictures, analogies, and worked examples in plain words.

1Why Planned Maintenance Can Still Cause Outages

The most dangerous moments for a healthy application are often the ones its owners chose on purpose.

When people think about outages, they picture disasters: a machine catches fire, a network cable is cut, a data center loses power. Those events do happen, but they are rare. Far more often, outages come from ordinary, planned work. A team upgrades the operating system on every machine. A cloud provider replaces old servers with new ones. An autoscaler decides the cluster is too big and removes a few machines to save money. In each case, somebody pressed a button and Kubernetes obediently emptied a machine.

Emptying a machine means stopping every pod on it. A pod is the smallest unit Kubernetes runs, usually holding one copy of your application. If you run six copies of a web service, and three of them happen to sit on the machine being emptied, then half of your capacity vanishes in one moment. If the other three are already busy, the remaining copies may be overwhelmed, and users start to see slow pages and errors.

Everyday analogy

Think of a bridge with six lanes. Road workers need to repair each lane in turn. If they close all six at once, traffic stops completely. If they close only one lane at a time, cars slow down slightly but keep flowing. A Pod Disruption Budget is the rule on the work permit: “You may close at most one lane at a time.”

The core problem, in one sentence

Kubernetes is very good at moving pods, but by default it does not know how many of them your application can afford to lose at once. You know that. The cluster does not, unless you tell it. The Pod Disruption Budget is how you tell it.

1
small object per application describes the safety rule
2
ways to write the rule: minimum available or maximum unavailable
0
effect on crashes, node failures, and direct deletions
i
Good to know

A Pod Disruption Budget does not make your application more powerful, faster, or more secure. It only makes planned maintenance polite. It is a promise between the owner of the application and the people who maintain the cluster.

2A Quick Kubernetes Refresher

A handful of everyday words are all you need to follow the rest of this guide.

WordPlain meaningEveryday picture
PodOne running copy of your application, sometimes with helper containersOne waiter on shift
NodeA computer, real or virtual, that runs podsA restaurant table area where several waiters work
ClusterA group of nodes managed togetherThe whole restaurant floor
DeploymentA manager that keeps a chosen number of identical pods running and rolls out new versionsA shift supervisor who keeps six waiters on duty
StatefulSetA manager for pods that need stable names and their own storageNamed waiters, each with their own locker
ServiceA steady address that sends traffic to ready podsThe restaurant phone number that always reaches a free waiter
Label and selectorA tag on an object, and a way to find all objects with a tagA colored badge, and a call for “everyone with a blue badge”
ReadinessWhether a pod is currently able to serve visitorsA waiter who is not only present but also alert and ready
API serverThe front desk of the cluster; every request goes through itThe reception desk that records every request
ControllerA program that watches the cluster and works to make reality match the wishA supervisor with a clipboard, constantly checking

Two more words will appear often. To cordon a node means to mark it as “do not place new pods here”. To drain a node means to cordon it and then politely ask every pod on it to leave, so the node can be worked on. Draining is the everyday event that Pod Disruption Budgets were designed to make safe.

Everyday analogy

Cordoning a node is like putting a “closed for cleaning” sign at the entrance of a table area, so no new guests are seated there. Draining is like gently asking the guests already seated to move to other tables before the cleaners arrive.

3What Is a Pod Disruption Budget?

A Pod Disruption Budget is a small Kubernetes object that limits how many pods of one application may be taken down voluntarily at the same time.

The word budget is a helpful clue. A budget is a limit on spending. Here, what you spend is availability. Suppose you run six copies of a service and decide you can tolerate losing one at a time. Then your budget is one disruption. Whenever maintenance wants to stop a pod, Kubernetes checks the budget. If the budget is not used up, the pod may go. If it is used up, the request is refused, and the maintenance tool must wait and try again.

What it is, why it exists, where it is used

What it is: a rule, stored as an object in the cluster, that names a group of pods and states either the minimum number that must stay available, or the maximum number that may be unavailable.

Why it exists: so that the people who own an application can protect it from well-meaning maintenance done by other people or by automated tools.

Where it is used: in nearly every production cluster, especially for web services, queues, databases, and any application where losing many copies at once would hurt. It is also checked by node upgrade tools, cluster autoscalers, and many cloud management systems.

Everyday analogy

Imagine a library that promises, “At least two librarians will always be at the desk.” Staff can still take breaks, attend meetings, and go on holiday. They just cannot all do it together. The promise does not say who must stay. It only says how many. A Pod Disruption Budget works the same way: it does not name specific pods, only a count.

!
Watch out

The name is a little misleading. It is not a budget of money or of resources such as memory. It is a budget of pods that may be missing at the same moment. The old word for the same idea in some systems is “quorum guard”.

4Voluntary and Involuntary Disruptions

The single most important idea about budgets is knowing which events they control and which they cannot.

Kubernetes divides the ways a pod can disappear into two groups. An involuntary disruption is something nobody chose: a machine crashes, the operating system freezes, a cloud provider takes back a machine without warning, or a pod is stopped because it used more memory than allowed. A voluntary disruption is something a person or program chose to do: draining a node for maintenance, upgrading a cluster, scaling down machines to save cost, or asking Kubernetes to move a pod.

A Pod Disruption Budget can only influence voluntary disruptions. This makes sense. If a machine loses power, no one asks permission first, so there is nothing to refuse. But when a person asks Kubernetes to stop a pod politely, Kubernetes has a moment to check the budget and say “not now”.

flowchart TD
    A["A pod stops running"] --> B{"Did someone choose this?"}
    B -->|No| C["Involuntary disruption"]
    B -->|Yes| D["Voluntary disruption"]
    C --> C1["Node hardware failure"]
    C --> C2["Kernel crash or power loss"]
    C --> C3["Container exceeds memory limit"]
    C --> C4["Cloud provider reclaims machine"]
    D --> D1["Node drain for maintenance"]
    D --> D2["Cluster upgrade"]
    D --> D3["Autoscaler removes a node"]
    D --> D4["Operator evicts a pod"]
    D1 --> E["Budget is checked"]
    D2 --> E
    D3 --> E
    D4 --> E
    C1 --> F["Budget is not consulted"]
    C2 --> F
    C3 --> F
    C4 --> F
    
Figure 1: Voluntary disruptions pass through the budget check. Involuntary ones do not.
EventKindDoes the budget apply?How to protect yourself
Draining a nodeVoluntaryYesDefine a sensible budget
Upgrading nodes in a managed clusterVoluntaryYes, usually with a time limitBudget plus enough spare capacity
Cluster autoscaler scale-downVoluntaryYesBudget, and mark pods that must not be moved
Deleting a pod directlyVoluntary in spirit, but bypasses the checkNoTeam discipline and access control
Node hardware failureInvoluntaryNoMore copies, spread across machines and zones
Out-of-memory stopInvoluntaryNoCorrect memory requests and limits
Rolling update of a DeploymentControlled by the Deployment itselfNot by the budgetUse the Deployment’s own update settings
i
Practical hint

Because budgets ignore involuntary events, they are never a substitute for running several copies spread across machines. The budget protects you from politeness gone wrong. Spreading protects you from bad luck.

5Architecture and Components

Several small parts cooperate to enforce a budget. Knowing who does what makes troubleshooting far easier.

A Pod Disruption Budget is only a piece of written intent. It does nothing by itself. Enforcement happens through a chain of components, each with a narrow job.

flowchart LR
    ADM["Administrator or automation"] --> DR["Drain tool or autoscaler"]
    DR -->|"Eviction request"| API["API Server"]
    API --> ADMIT["Eviction admission check"]
    ADMIT --> PDB["PodDisruptionBudget object"]
    DC["Disruption Controller"] -->|"Computes status"| PDB
    DC -->|"Watches"| WL["Deployment, StatefulSet, ReplicaSet"]
    DC -->|"Counts ready pods"| PODS["Pods matched by selector"]
    ADMIT -->|"Allowed"| DEL["Pod is deleted gracefully"]
    ADMIT -->|"Refused with too many requests"| DR
    DEL --> KL["Kubelet on the node"]
    KL --> PODS
    
Figure 2: The components involved in checking and enforcing a Pod Disruption Budget.

The cast of characters

Object

The budget itself

A small record naming a group of pods by label and stating the rule. Its status section holds live numbers written by a controller.

Controller

The disruption controller

A built-in program that keeps counting how many pods match, how many are ready, and how many more may be removed. It updates the budget’s status continually.

Gate

The eviction check

When someone asks to evict a pod, the API server looks at the budget’s status and either allows or refuses the request.

Requester

Drain tools and autoscalers

Programs that ask politely for pods to leave. They respect refusals by waiting and retrying.

Owner

Workload controllers

Deployments and StatefulSets replace evicted pods on other nodes. They also tell the disruption controller how many pods are expected.

Executor

The kubelet

The agent on each node that actually stops the containers, following the graceful shutdown steps.

Everyday analogy

Consider an airport gate. The airline sets a rule: “Never let more than two flight attendants leave the plane at once.” The gate agent is the eviction check, looking at a live board showing how many attendants are on board. The board is updated by a staff member with a clipboard, the disruption controller, who is always counting. When a supervisor asks for an attendant to go on break, the gate agent checks the board and either says yes or asks them to come back in a few minutes.

6The Settings of a Budget

A budget has only a few settings. Each one deserves a careful look.

SettingWhat it doesAccepted values
SelectorChooses which pods the budget protects, using labelsLabel match, usually the same labels the Deployment uses
Minimum availableThe fewest pods that must remain ready after a disruptionA whole number, or a percentage
Maximum unavailableThe most pods that may be missing after a disruptionA whole number, or a percentage
Unhealthy pod eviction policyHow to treat pods that are already not readyDefault behavior or an “always allow” option, in newer versions

Two ways to say the same thing

You may set minimum available or maximum unavailable, but never both in the same budget. They are two views of one rule. If you run six pods, then “minimum five available” and “maximum one unavailable” describe exactly the same limit. The difference appears when the number of pods changes. A minimum of five with ten pods allows five to be disrupted. A maximum of one with ten pods still allows only one.

Everyday analogy

A classroom rule can be written two ways: “At least twenty students must stay in the room” or “No more than five students may leave at once”. With twenty-five students, both mean the same. With thirty students, the first now allows ten to leave, while the second still allows five. Pick the phrasing that matches how your group changes size.

The selector: the part beginners get wrong

The selector must match the labels on the pods, not the name of the Deployment. If it matches nothing, the budget protects nothing, and worse, it gives a false feeling of safety. If it matches too much, it may lump unrelated pods together and block maintenance for no reason. Always confirm, after creating a budget, that the number of pods it reports matches the number you expect.

!
Watch out

A budget with a selector that matches zero pods is accepted without error. It simply does nothing. Check its status to see how many pods it actually sees.

7Choosing Between Minimum Available and Maximum Unavailable

Both forms work. The right choice depends on what you care about most and how your application scales.

flowchart TD
    A["Start: choose a budget style"] --> B{"Does the app need a fixed number of pods to work, such as a quorum?"}
    B -->|Yes| C["Use minimum available with a whole number"]
    B -->|No| D{"Does the number of pods change often, for example with autoscaling?"}
    D -->|Yes| E["Use maximum unavailable, often as a percentage"]
    D -->|No| F{"Do you prefer to think in terms of capacity or of loss?"}
    F -->|Capacity| G["Use minimum available"]
    F -->|Loss| H["Use maximum unavailable"]
    C --> Z["Check the result against replica counts"]
    E --> Z
    G --> Z
    H --> Z
    
Figure 3: A simple decision path for choosing how to write a budget.

Minimum available: best for

  • Clustered systems that need a majority, such as three-member data stores that need two alive.
  • Applications with a known minimum capacity to serve normal traffic.
  • Teams who think in terms of “how many must remain”.

Maximum unavailable: best for

  • Deployments that scale up and down, since the allowed loss stays constant.
  • Very large fleets, where a percentage is natural.
  • Teams who think in terms of “how many may be missing”.

Whole numbers and percentages

Either setting can be a whole number or a percentage. A percentage is calculated against the expected number of pods and rounded up. Rounding up is important. With three pods and a maximum unavailable of thirty percent, the exact result is 0.9, and that is rounded up to one. With a minimum available of ninety percent on three pods, the exact result is 2.7, rounded up to three, which means no pod may be disrupted at all. This surprises many people. Small numbers and percentages do not mix well.

PodsSettingExact resultEffective rulePods that may be disrupted
3Minimum available 90 percent2.7Round up to 3 must stay0
3Maximum unavailable 30 percent0.9Round up to 1 may go1
10Minimum available 80 percent88 must stay2
10Maximum unavailable 25 percent2.5Round up to 3 may go3
20Maximum unavailable 10 percent22 may go2
1Minimum available 111 must stay0
i
Practical hint

Before you finalize any budget, take your usual number of pods and your smallest number of pods, and work out by hand how many disruptions the rule allows. If the answer is zero at any time, you have created a budget that can block maintenance.

8How It Works Internally: The Eviction Path

The budget is enforced at one specific moment: when a polite request to remove a pod reaches the API server.

Kubernetes has two ways to remove a pod. The blunt way is a direct delete. It simply removes the pod, and no budget is consulted. The polite way is an eviction. An eviction is a special request that says, “Please remove this pod, if it is safe.” When the API server receives an eviction, it looks up every budget that matches the pod and checks whether the removal would break any of them.

If all budgets allow it, the API server deletes the pod using the normal graceful shutdown steps, and reduces the count of allowed disruptions. If any budget refuses, the API server answers with an error meaning “too many requests” and leaves the pod untouched. The caller is expected to wait and try again later.

sequenceDiagram
    participant Admin as Administrator
    participant Drain as Drain Tool
    participant API as API Server
    participant PDB as Budget Status
    participant Node as Node and Kubelet
    participant Dep as Deployment Controller
    Admin->>Drain: Drain node A
    Drain->>Node: Mark node A as unschedulable
    Drain->>API: Evict pod 1
    API->>PDB: Are disruptions allowed
    PDB-->>API: Yes, one allowed
    API->>Node: Delete pod 1 gracefully
    API->>PDB: Reduce allowed disruptions to zero
    Drain->>API: Evict pod 2
    API->>PDB: Are disruptions allowed
    PDB-->>API: No, zero allowed
    API-->>Drain: Refused, try again later
    Dep->>Node: Create replacement pod on node B
    Node-->>PDB: Replacement becomes ready
    PDB-->>PDB: Allowed disruptions rises to one
    Drain->>API: Retry evict pod 2
    API-->>Drain: Allowed
    
Figure 4: A drain that respects the budget, waiting for a replacement before evicting the next pod.

Step by step

1

The node is cordoned

The drain tool marks the node so that no new pods are placed on it. This prevents pods from bouncing back onto the node being emptied.

2

An eviction is requested for each pod

The drain tool asks the API server, one pod at a time, to evict. It uses the polite path, not a blunt delete.

3

The budget is consulted

The API server reads the budget’s live status. If the number of disruptions allowed is greater than zero, the request may proceed.

4

The pod shuts down gracefully

The pod is marked as terminating. It is removed from traffic, receives a stop signal, and has a grace period to finish current work.

5

A replacement is created elsewhere

The owning Deployment sees a missing pod and creates a new one, which the scheduler places on a node that is still open.

6

The budget recovers only when the replacement is ready

The number of allowed disruptions rises again only when the new pod passes its readiness check. Until then, further evictions are refused.

7

The drain continues, patiently

The tool retries refused evictions after a short pause. It proceeds one small step at a time until the node is empty.

9Reading the Status: The Four Numbers

A budget’s status section tells you everything about its current state in four simple numbers.

Number 1

Expected pods

How many pods the owning controller says should exist. This is the base for any percentage calculation.

Number 2

Current healthy

How many of the matching pods are ready right now. Pods that exist but are not ready do not count.

Number 3

Desired healthy

The minimum that must stay ready, calculated from the rule and the expected pods.

Number 4

Disruptions allowed

Current healthy minus desired healthy, never below zero. This is the number the eviction check reads.

Everyday analogy

Think of a scoreboard at a swimming pool. It shows how many lifeguards are required, how many are on duty and alert, and how many could leave for a break. The last number is simply the difference between the first two. When it shows zero, nobody may leave until someone else returns.

Worked examples

ScenarioExpectedHealthy nowDesired healthyDisruptions allowed
Six pods, minimum available 5, all ready6651
Same, but one pod is not ready6550
Six pods, maximum unavailable 2, all ready6642
Three pods, minimum available 2, all ready3321
Three pods, minimum available 33330
Ten pods, maximum unavailable 20 percent, 9 ready10981

Notice the second row. When one pod is already unhealthy, the healthy count equals the required minimum, so no further disruption is permitted. This is the right behavior: if you are already down to your safe limit, planned maintenance must wait. But it also explains a common frustration. A single broken pod can freeze an entire drain until it is repaired.

i
Practical hint

When a drain hangs, the first thing to check is the budget’s disruptions-allowed number. If it is zero, the question becomes: why is a pod not ready, or why is the rule too tight?

10The Life of a Budget: Data Flow and Lifecycle

A budget moves between states as pods leave and return, and the pattern is worth memorizing.

stateDiagram-v2
    [*] --> Created
    Created --> Counting : "Selector matches pods"
    Counting --> RoomAvailable : "Healthy pods exceed desired"
    RoomAvailable --> BudgetSpent : "An eviction is approved"
    BudgetSpent --> Recovering : "Replacement pod is starting"
    Recovering --> RoomAvailable : "Replacement becomes ready"
    Counting --> Blocked : "Healthy equals desired"
    Blocked --> RoomAvailable : "Unhealthy pod recovers"
    RoomAvailable --> [*] : "Budget deleted"
    
Figure 5: The states a budget passes through during normal operation.
1

Creation

You create the budget. The disruption controller finds the matching pods and calculates the four numbers within moments.

2

Steady state

While all pods are ready, the allowed count sits at a positive value. Maintenance can proceed within it.

3

Spending

Each approved eviction reduces the allowed count. When it reaches zero, further requests are refused.

4

Recovery

Replacements start, pass readiness, and the count rises. Refused requests can now succeed on retry.

5

Changes to the workload

If the Deployment is scaled up or down, the expected count and the required minimum are recalculated, and the allowed count follows.

6

Deletion

If you delete the budget, protection ends immediately. Pods become freely evictable again.

!
Watch out

The status is recalculated shortly after each change, not instantly. Right after a pod becomes ready, the allowed count may lag by a moment. This is normal, and it is why drain tools wait and retry instead of expecting an immediate yes.

11What a Budget Does Not Do

Knowing the limits of a tool prevents false confidence, which is more dangerous than no tool at all.

Limit

It does not stop crashes

If a node dies or a container runs out of memory, no request is made, so no check happens.

Limit

It does not stop direct deletion

A person who deletes a pod by name, or a script that deletes pods in bulk, bypasses the budget entirely.

Limit

It does not control rolling updates

A Deployment’s rolling update follows the Deployment’s own settings for surge and unavailability. The budget is not consulted when new versions replace old ones.

Limit

It does not create capacity

If the other nodes are full, evicted pods cannot be replaced. The budget only limits how fast you lose pods, not whether they can find a new home.

Limit

It does not guarantee ready pods forever

It guarantees only that voluntary actions will not push the ready count below the limit at the moment of each eviction.

Limit

It cannot override every actor

Higher-priority pods can preempt lower ones, and the scheduler may not always honor budgets when making room in emergencies.

flowchart LR
    subgraph Governed["Protected by the budget"]
        A["Node drain"]
        B["Autoscaler scale-down"]
        C["Managed upgrade of nodes"]
    end
    subgraph NotGoverned["Not protected by the budget"]
        D["Direct pod deletion"]
        E["Rolling update of a Deployment"]
        F["Node crash"]
        G["Out-of-memory stop"]
    end
    A --> H["Eviction request"]
    B --> H
    C --> H
    H --> I["Budget check"]
    D --> J["Pod removed immediately"]
    E --> K["Deployment's own limits apply"]
    F --> J
    G --> J
    
Figure 6: Which paths pass through the budget and which bypass it.
Everyday analogy

A “no more than two lanes closed” permit binds the road workers who apply for it. It does not stop a truck from breaking down in a third lane, and it does not bind a separate crew that repaints the lines under a different permit. The permit works well for the crews who respect it, and it says nothing about anyone else.

12Budgets and Readiness Probes Work Together

A budget counts ready pods, so the quality of your readiness checks decides how useful your budget is.

The disruption controller does not count pods that merely exist. It counts pods that are ready. A pod is ready when its readiness probe passes, meaning the application says it can serve visitors. This link is powerful, because it means a new replacement pod does not restore the budget until it can truly take traffic. It gives the whole system a safe rhythm: evict one, wait for its replacement to be genuinely ready, then evict the next.

Everyday analogy

Think of a relay race where a runner may leave the track only when the next runner has firmly grasped the baton. “Standing at the starting line” is not enough. The handover counts only when the new runner is really ready to run. Readiness is that firm grasp.

What goes wrong when readiness is poor

Readiness qualityEffect on the budgetResult during a drain
No readiness probe at allPods count as ready the instant they startThe budget recovers too early, and the next eviction happens before the replacement can serve
A probe that always says yesSame as aboveBursts of errors during maintenance, despite a budget
A probe that is too strict or flakyHealthy pods flip between ready and not readyThe allowed count bounces to zero, and drains stall unpredictably
A probe that checks a shared databaseAll pods become unready together if the database slowsAllowed count drops to zero everywhere, blocking all maintenance
A well-designed probeReady means truly readySmooth, predictable, safe drains
i
Practical hint

Consider adding a short “minimum ready” wait to your Deployment, so a new pod must stay ready for a few seconds before it counts as available. This catches applications that pass the first check and fail a moment later.

13Node Drains, Upgrades, and Autoscalers

Three everyday operations lean on your budget. Each treats it a little differently.

Manual node drains

When an engineer drains a node, the drain tool asks for evictions and keeps retrying refused ones. It waits patiently, and by default it may wait a very long time. If a budget can never be satisfied, the drain simply hangs. Engineers can set a time limit on the drain, and can choose to skip certain kinds of pods, but they should not casually override budgets. Overriding is the path to the outage the budget was created to prevent.

Cluster upgrades

Upgrading a cluster usually means replacing or restarting every node in turn. Each node is drained before it is changed. Managed services from cloud providers automate this. They generally respect budgets for a limited time, and then either stop and report a problem or proceed anyway, depending on the provider and settings. This means an overly tight budget can turn a routine upgrade into a stuck, half-finished one, and a missing budget can turn it into an outage. Read your provider’s documentation on how long it waits and what it does when it gives up.

Autoscalers removing machines

A cluster autoscaler adds machines when pods cannot be placed and removes machines that are underused. Before removing a machine, it checks whether every pod on it can be moved without violating a budget. If a budget would be broken, the machine is left in place. Modern node provisioning tools follow the same principle. So an over-tight budget can keep your cluster larger, and more expensive, than it needs to be.

flowchart TD
    A["Maintenance trigger"] --> B{"Which kind?"}
    B -->|"Manual drain"| C["Drain tool retries refused evictions"]
    B -->|"Cluster upgrade"| D["Provider drains nodes one by one"]
    B -->|"Autoscaler scale-down"| E["Autoscaler simulates the move"]
    C --> F{"Budget allows?"}
    D --> F
    E --> F
    F -->|Yes| G["Pod evicted and replaced elsewhere"]
    F -->|No| H["Wait, retry, or give up after a limit"]
    H --> I["Drain stuck, upgrade delayed, or node kept"]
    G --> J["Node becomes empty and can be changed or removed"]
    
Figure 7: How three common operations react to a budget.
Everyday analogy

Consider three visitors to a busy restaurant kitchen who each want a cook to step out: an inspector asking for a chat, a cleaner wanting to mop a section, and an accountant wanting to reduce staff. All three must respect the same rule: “The kitchen must always keep at least four cooks working.” Each handles a refusal differently. The inspector waits, the cleaner returns later, and the accountant decides not to reduce staff today.

!
Common trap

Teams often discover an over-tight budget only during the annual upgrade, when it is inconvenient and stressful. Rehearse upgrades and drains in a test environment, so surprises appear early.

14Stateful and Quorum-Based Systems

For databases and clustered systems, a budget is not a courtesy. It is a survival rule.

Some applications only work while a majority of their members are alive. This is called a quorum. A quorum is like a vote: a decision counts only if more than half of the members agree. If a three-member group loses two members, the remaining one cannot form a majority and stops accepting changes to avoid making conflicting decisions. Coordination services, distributed databases, and message brokers commonly work this way.

MembersMajority neededMembers that may be lostSensible budget
321Minimum available 2, or maximum unavailable 1
532Minimum available 3, or maximum unavailable 1 for extra caution
743Maximum unavailable 1 or 2, depending on risk appetite
220No safe disruption; add a third member
Everyday analogy

A committee of five needs three people present to hold a valid vote. If two members step out, the meeting continues. If a third leaves, the meeting must stop, since any decision could later be disputed. The budget says, “Never let more than two leave at once,” so the meeting never has to stop.

Extra care for stateful workloads

  • Prefer a maximum of one unavailable. For data stores, losing one member at a time is usually the safest pace, even if the majority would tolerate more.
  • Wait for full recovery, not only readiness. A replacement member may be “ready” while still copying data from its peers. Design the readiness check to report ready only after it has caught up.
  • Remember the storage. A replacement pod must reattach to the right disk, which may be in one zone only. If the disk’s zone has no free node, the replacement stays pending and the budget stays spent.
  • Do not rely on the budget alone. Also spread members across machines and zones, keep backups, and test recovery.
i
Practical hint

Many popular database and messaging operators create budgets automatically. Check what they created and whether the numbers suit your risk level, rather than assuming the default is right for you.

15Spreading Pods: Anti-affinity, Topology, and Zones

A budget limits how many pods leave at once. Spreading limits how many are on one machine in the first place. You need both.

Suppose you run six copies with a budget that allows one to be disrupted at a time. If the scheduler places all six on one machine, then draining that machine tries to evict six pods, and the budget allows only one at a time. Each replacement has to be placed on another machine, and the drain becomes slow and awkward. Worse, if that one machine crashes, all six are lost at once, and the budget does nothing.

Tool

Pod anti-affinity

A rule that says “do not place me on the same machine or zone as another pod with this label”. It can be strict or a soft preference.

Tool

Topology spread constraints

A rule that asks the scheduler to keep the number of pods per machine or per zone roughly even, within a chosen difference.

Tool

Multiple zones

Running nodes across several data-center zones means a whole zone can fail while others continue.

Tool

Budget

Limits how many pods can be removed at once by planned actions.

flowchart LR
    subgraph Z1["Zone A"]
        N1["Node 1: pod 1, pod 2"]
    end
    subgraph Z2["Zone B"]
        N2["Node 2: pod 3, pod 4"]
    end
    subgraph Z3["Zone C"]
        N3["Node 3: pod 5, pod 6"]
    end
    LB["Service"] --> N1
    LB --> N2
    LB --> N3
    B["Budget: at most 1 unavailable"] -.-> N1
    B -.-> N2
    B -.-> N3
    
Figure 8: Six pods spread across three zones, protected by a budget that allows one disruption at a time.
Everyday analogy

If you keep all your savings in one bag, the rule “never carry more than one bag at a time” is useless when the bag is stolen. Spreading savings across several places means that even a theft loses only a part. The budget is the carrying rule. Spreading is the choice of where to keep things.

!
Watch out

A strict “one pod per node” rule with more pods than nodes leaves some pods pending forever. That makes the budget’s healthy count low, and can block every drain. Prefer flexible spreading rules for small clusters.

16Budgets and Autoscaling of Pods

When the number of pods changes with load, the budget must still make sense at the smallest size.

A horizontal pod autoscaler adds and removes pod copies as demand rises and falls. Suppose it runs between two and twenty copies. At night you may have only two. A budget of “minimum available 80 percent” on two pods rounds up to two, so no disruption is allowed. Any drain touching those pods hangs until morning. During the day, with twenty pods, the same rule allows four disruptions. The rule that suits daytime blocks night-time maintenance.

Autoscaled sizeMinimum available 80 percentMaximum unavailable 1Maximum unavailable 20 percent
2 podsRound up to 2 must stay; 0 may go1 may go0.4 rounds up to 1 may go
5 pods4 must stay; 1 may go1 may go1 may go
10 pods8 must stay; 2 may go1 may go2 may go
20 pods16 must stay; 4 may go1 may go4 may go

The table shows that maximum unavailable, especially as a percentage, adapts more gracefully to changing sizes. A fixed count of one is the most cautious and the most predictable. Choose according to how much loss your service can bear at its smallest size, not its average size.

Everyday analogy

A shop that opens with two staff on quiet mornings and twenty on busy afternoons cannot use the rule “at least eighty percent of staff must stay”. In the morning that rule means nobody may ever take a break. A rule like “no more than one person on break at once” works at every size.

i
Practical hint

Set the autoscaler’s minimum size to at least the number your budget needs to permit one disruption. For a budget requiring two healthy pods, a minimum of three copies is the smallest size that leaves room to drain.

17Graceful Termination Completes the Picture

The budget decides whether a pod may leave. Graceful termination decides how well it leaves.

Once an eviction is approved, the pod does not vanish instantly. It goes through the same graceful shutdown as any deleted pod. First, it is marked as terminating and removed from the list of pods receiving traffic. Then the application is sent a polite stop signal and given a grace period, thirty seconds by default, to finish what it is doing. Only after that is the container stopped by force.

If your application ignores the stop signal or takes longer than the grace period to finish, users lose in-flight requests every time a pod is evicted. A budget cannot fix that. It only limits how many such losses happen at once.

1

Eviction approved

The budget allows it, and the pod is marked as terminating.

2

Traffic stops arriving

The pod is taken off Service lists. A short pause before shutdown gives every part of the network time to notice.

3

The application drains its work

It stops accepting new requests, finishes current ones, and closes connections cleanly.

4

The container exits

If it is done before the grace period ends, it exits early, and the node is one step closer to empty.

5

The replacement takes over

The new pod becomes ready elsewhere, the budget recovers, and the next eviction can proceed.

!
Watch out

A very long grace period slows every drain, because each pod takes that long to leave. Set it to slightly more than your slowest normal request, not to a huge number “to be safe”.

18Handling Pods That Are Already Unhealthy

A broken pod can block the very maintenance that would fix it. Newer versions of Kubernetes offer a way out.

Imagine a pod stuck in a crash loop on a node that needs an urgent security update. The pod is not ready, so it is not counted as healthy. Under the default behavior, Kubernetes allows evicting an unhealthy pod only if the budget would still be satisfied without it, which usually means only when enough other pods are healthy. If several pods are unhealthy at the same time, the budget may refuse to evict any of them, and a broken pod can hold the node hostage.

To handle this, newer versions of Kubernetes let you choose an unhealthy pod eviction policy. With the default choice, an unhealthy pod is evictable only when the budget is otherwise satisfied. With the “always allow” choice, pods that are not ready may be evicted regardless of the budget, since they were not contributing to availability anyway. This frees drains from being blocked by pods that are already broken.

Advantages of the always-allow choice

  • Broken pods cannot block drains and upgrades.
  • Crash-looping pods are replaced sooner, possibly on a healthier node.
  • Fewer late-night interventions to unstick maintenance.

Cautions

  • A pod that is briefly not ready, such as one still warming up, could be evicted sooner than you would like.
  • For systems where a not-ready member still holds valuable data, removing it may be unwise.
  • Availability of this option depends on your Kubernetes version.
Everyday analogy

If a librarian has fallen asleep at the desk, they are not really helping the visitors. A rule that says “at least two librarians must stay” should not stop you from sending the sleeping one home, since they were not counted as helpful anyway. The always-allow option is that common-sense exception.

19Selectors, Overlaps, and Which Pods Are Covered

A budget covers whichever pods its selector matches, and mistakes here cause both silent gaps and hard failures.

Three selector situations

Gap

Selector matches nothing

The budget exists but protects no pod. Typical cause: a label was renamed on the Deployment and not on the budget.

Too wide

Selector matches unrelated pods

A vague label such as one shared by many applications lumps them together. The combined count makes the rule meaningless for each.

Overlap

Two budgets match one pod

Kubernetes cannot reason cleanly about overlapping budgets. Eviction requests for such pods can fail with an error, even when both budgets would allow it.

The overlap case deserves emphasis. Each application should have exactly one budget, and each pod should match exactly one. When several teams share a namespace, it is easy for one to create a broad budget that overlaps another team’s. The result is puzzling drain failures that seem to have no cause. A quick review of all budgets in a namespace, comparing selectors, catches this.

Which workloads can be covered

Budgets work best with pods managed by the well-known controllers: Deployments, ReplicaSets, StatefulSets, and their relatives. These controllers tell the disruption controller how many pods to expect, so percentages and maximum-unavailable rules can be computed. For pods managed by custom controllers or created directly, options are more limited, and often only a whole-number minimum available works. Check your version’s documentation when using unusual controllers.

i
Practical hint

Give every application a clear, unique label such as an application name, and use that same label in both the Deployment’s pods and the budget’s selector. Consistency prevents nearly all selector mistakes.

20Performance and Scalability

Budgets are light, but their effect on the speed of maintenance is significant.

The disruption controller does very little work. It watches pods and workloads and updates a few numbers. Even in large clusters with thousands of budgets, this cost is small. The real effect of a budget is on the time that maintenance takes, because a budget serializes evictions. If your budget allows one disruption at a time and each replacement takes ninety seconds to become ready, then draining a node holding ten pods of that application takes at least fifteen minutes.

90 s
example time for a replacement to become ready
10
pods of one application on a node being drained
15 min
minimum drain time with one disruption at a time

Factors that determine drain speed

  • Disruptions allowed. A larger allowance lets more pods leave in parallel.
  • Startup time. Slow-starting applications make every recovery slower. Startup probes and faster images help.
  • Image pulling. If a replacement lands on a node that lacks the image, it must first download it. Keeping images small and pre-loaded reduces the delay.
  • Spare capacity. Replacements can start only where there is room. A tight cluster makes pods wait for space.
  • Number of nodes drained together. Upgrading many nodes at once multiplies the load on budgets. Upgrade a few nodes at a time.
  • Grace period. Each pod’s shutdown time adds to the total.
Everyday analogy

Think of a ferry that can carry only one car at a time because of a safety rule. The rule keeps everyone safe, but a long queue of cars takes a long time to cross. Adding a second ferry, meaning a higher allowance and more spare capacity, speeds things up without breaking the rule.

i
Practical hint

When planning a maintenance window, estimate the time by multiplying the number of pods per node by recovery time, and dividing by the allowed number of parallel disruptions. Add a margin. This turns a vague worry into a concrete schedule.

21High Availability and Reliability

A budget is one layer of a reliable system. It works best beside several others.

LayerProtects againstRelationship with the budget
Multiple replicasLoss of any single podThe budget assumes there are enough replicas to spare one
Spreading across nodes and zonesMachine and zone failuresReduces how many pods each drain touches
Readiness probesSending traffic to unready podsDefines what counts as healthy for the budget
Resource requests and limitsOverload and eviction from crowded nodesEnsures replacements can be placed
Graceful terminationDropped requests during shutdownMakes each approved eviction painless
AutoscalingTraffic peaksChanges pod counts, so the budget must fit the smallest size
Backups and recovery drillsData loss and human errorNot related; the budget cannot restore data

Design for the sum of losses

A useful way to plan is to add up everything that can be missing at the same time. Suppose you need four pods to handle your peak traffic. During a drain, one pod may be missing because of the budget. At the same time, a machine might fail and take another. A wise design therefore runs at least six pods: four for the load, one for the drain, and one for bad luck. This is often called N plus two planning.

Everyday analogy

An airline that needs four pilots for a flight does not schedule exactly four. It plans for one to be sick and one more to be delayed in traffic. Spare people are not waste. They are how a schedule survives an ordinary bad day.

22Security Considerations

A tool that can block maintenance can also be misused, on purpose or by accident.

Abuse

Blocking upgrades on purpose

In a shared cluster, a tenant could set a budget that never allows disruption, stalling node upgrades and security patches for everyone.

Abuse

Delaying patching

A budget that stalls drains delays operating system and Kubernetes security fixes on nodes, leaving known weaknesses open longer.

Access

Who may edit budgets

Permission to create or change budgets is a real power. Grant it through narrow roles, only in the namespaces where it is needed.

Access

Who may evict or delete

Eviction and deletion permissions determine who can bypass or trigger the check. Keep them tight, as pod deletion ignores budgets.

Policy

Guardrails through admission rules

Cluster administrators can add policies that reject budgets with unreasonable values, such as zero allowed disruptions for multi-replica services.

Audit

Record changes

Keep budgets in version control and review changes. An unexpected edit to a budget is a signal worth investigating.

Everyday analogy

In a shared office building, any tenant may ask that their floor stay staffed during fire-safety inspections. But if one tenant demanded that inspectors never enter, the whole building would remain unchecked. Building managers therefore set reasonable limits on what any tenant may demand.

!
Watch out

The opposite risk is real too: a person with broad permissions can delete a budget to push a risky change through. Treat budget deletion in production as a change that needs the same review as any other important setting.

23Monitoring, Logging, and Metrics

You want to know a budget is blocking maintenance before an engineer is staring at a frozen drain at midnight.

Metric

Disruptions allowed

Cluster state exporters publish the allowed count per budget. A value of zero that lasts a long time is the clearest warning sign.

Metric

Current healthy against desired healthy

Comparing the two shows how close you are to the limit. A permanent gap of zero means no room for maintenance.

Metric

Expected pods

Confirms the budget sees the number of pods you think it does. A value of zero means the selector matches nothing.

Events

Eviction refusals

Drain tools and the API server record refused evictions. Repeated refusals for the same pod point to a stuck budget.

Logs

Drain and upgrade logs

Upgrade tools log when they wait on a budget and when they give up. Keep these logs after the upgrade finishes.

Metric

Node drain duration

Tracking how long each drain takes reveals a slow drift toward tighter budgets or slower application starts.

Alerts worth setting up

  • A budget has had zero allowed disruptions for longer than a chosen period, such as thirty minutes, while all its pods are supposed to be healthy.
  • A budget’s expected pods is zero while a matching application exists, which suggests a selector mistake.
  • An application with more than one replica has no budget at all. This can be checked by a periodic report.
  • A budget’s minimum available equals the total number of replicas, which makes maintenance impossible.
  • A node has stayed cordoned for a long time, meaning a drain probably stalled.
Everyday analogy

A traffic control room does not wait for drivers to complain that a road is blocked. It has sensors that report queue length. A budget dashboard is the same: a few simple numbers that warn you the queue is growing.

24Advantages, Disadvantages, and Trade-offs

Budgets are simple and powerful, and like every safety rule, they have a price.

Advantages

  • Protects availability during planned work. Maintenance can never remove too many pods at once.
  • Simple to write. A few lines of intent replace long maintenance runbooks and human vigilance.
  • Works with many tools. Drain commands, autoscalers, and cloud upgrade services all respect it.
  • Owned by the application team. The people who know the application set the limit, not the people running the machines.
  • Self-adjusting. Status numbers update automatically as pods come and go.
  • Encourages good design. Thinking about the number of pods that can be lost forces teams to plan capacity honestly.

Disadvantages

  • Can block maintenance. A budget that is too tight, or a pod that is not ready, can freeze drains and upgrades.
  • Only voluntary events. It gives no protection against crashes or direct deletions.
  • Depends on good readiness. A poor probe makes the count misleading.
  • Easy to misconfigure. Selectors, rounding of percentages, and overlaps trip up many teams.
  • Slows maintenance. Evictions become serial, and upgrades take longer.
  • Can keep costs high. Autoscalers may refuse to remove nodes that hold protected pods.

The main trade-offs

Safety versus speed. A strict budget makes maintenance safer and slower. A loose budget makes it faster and riskier. The right point depends on how costly a brief loss of capacity is for your service.

Predictability versus flexibility. A fixed whole number behaves the same at every size. A percentage adapts to growth but can surprise you at small sizes.

Ownership versus coordination. Letting each team write its own budget gives them control, but requires a shared standard so that budgets do not clash with the platform team’s need to upgrade.

A budget is a promise about the worst planned day, not about the worst possible day.

25Design Patterns That Work

A few tried habits produce budgets that protect without blocking.

Pattern

One budget per application

Each application gets exactly one budget with a clear selector. No overlaps, no gaps.

Pattern

Maximum unavailable of one for small fleets

For groups up to about ten pods, allowing one loss at a time is simple, safe, and predictable.

Pattern

Percentage for large fleets

For groups of many dozens, a percentage such as ten or twenty percent keeps maintenance moving.

Pattern

Quorum-aware numbers

For clustered data systems, write the budget from the majority rule, and prefer losing one at a time.

Pattern

Budget, spread, and spare

Pair the budget with spread rules across nodes and zones, and run enough replicas for N plus two.

Pattern

Budgets as part of the release files

Ship the budget in the same package as the Deployment, so no application goes live without one.

Pattern

Platform-level defaults

Platform teams provide templates and policies that create sensible budgets automatically, reducing forgotten protections.

Pattern

Rehearsed drains

Regularly drain a node in a test cluster, timing it and noticing where budgets block.

26Anti-patterns to Avoid

These are the habits that turn a helpful budget into a source of pain.

ANTI-PATTERN 01 · MINIMUM AVAILABLE EQUALS REPLICASAvoid
What people do

They require every single pod to be available, for example three of three, believing this is the safest choice.

Why it hurts

No pod can ever be evicted voluntarily. Node drains and upgrades hang forever, and someone eventually overrides the budget under pressure.

What to do instead

Always leave room for at least one disruption. If that is truly impossible, add a replica so it becomes possible.

ANTI-PATTERN 02 · A BUDGET ON A SINGLE REPLICAAvoid
What people do

They run one pod and add a budget requiring one available, hoping to prevent any downtime.

Why it hurts

The budget blocks all planned maintenance on that pod’s node. It does not stop crashes, so it gives no real protection, and it makes upgrades painful.

What to do instead

Run at least two replicas, then use a budget that allows one to move at a time. If a single pod is unavoidable, accept short planned downtime and skip the budget.

ANTI-PATTERN 03 · COPY-PASTED SELECTORSAvoid
What people do

They copy a budget from another application and forget to change the labels in its selector.

Why it hurts

The budget silently protects the wrong pods, or two budgets overlap on the same pods, which makes eviction fail unexpectedly.

What to do instead

Generate budgets from the same source as the Deployment, and verify the expected pods number after every change.

ANTI-PATTERN 04 · DELETING THE BUDGET TO FINISH AN UPGRADEAvoid
What people do

When a drain hangs, they delete the budget, finish the upgrade, and forget to restore it.

Why it hurts

The application is now unprotected for the next maintenance. The underlying problem, a tight rule or an unready pod, is never fixed.

What to do instead

Investigate why no disruptions are allowed. Fix the cause, for example a broken pod or too few replicas. If a temporary change is unavoidable, record it and restore it.

ANTI-PATTERN 05 · PERCENTAGES ON TINY FLEETSAvoid
What people do

They use a high minimum-available percentage on a workload with two or three pods.

Why it hurts

Rounding up turns the rule into “all pods must stay”, which is the same as anti-pattern one.

What to do instead

For small groups, use whole numbers. Reserve percentages for groups large enough that rounding does not dominate.

27Best Practices and Common Mistakes

A short checklist prevents almost all budget trouble.

Best practices

Do

Run at least two, ideally three, replicas

A budget only makes sense when there is a copy to spare.

Do

Verify the four numbers

After creating a budget, check expected pods, current healthy, desired healthy, and allowed disruptions.

Do

Always leave room to move

The allowed count should be at least one whenever all pods are healthy.

Do

Fix readiness first

Reliable probes make the budget meaningful.

Do

Plan spare capacity

Leave room on other nodes so evicted pods can land quickly.

Do

Version and review

Keep budgets in files, reviewed with the rest of the application.

Common mistakes

Assuming the budget stops rolling updates

Rolling updates follow the Deployment’s own settings. If you need them to be gentle, adjust those settings separately.

Assuming the budget stops crashes

It only governs voluntary evictions. Involuntary events need spread, spare capacity, and good resource settings.

Forgetting the smallest size

Testing the budget only at the normal replica count, and not at the autoscaler’s minimum.

Ignoring the platform team’s needs

Setting rules so tight that the platform team cannot patch nodes, then being surprised when upgrades are delayed.

Not telling anyone

Budgets are invisible to people who do not look. Document them, and tell the team who upgrades the cluster.

Skipping the drill

Discovering a blocking budget for the first time during a real upgrade, rather than in a rehearsal.

28Real-World and Industry Examples

The same idea appears in every kind of organization that runs Kubernetes at scale.

Online shops and busy APIs

Retail platforms run many copies of checkout and catalog services across zones. A percentage-based budget lets platform teams patch machines throughout the week while ensuring that enough copies always serve customers, even on sale days.

Cloud provider managed clusters

Managed Kubernetes services upgrade nodes automatically and generally respect budgets for a limited time. Customers who define sensible budgets get smooth upgrades. Those with blocking budgets often see upgrades stall, or with none, see brief errors.

Databases and message brokers

Operators for popular databases and message systems create budgets that allow one member to be disrupted at a time, matching the quorum rules of the systems they manage. This keeps clusters writable while machines are patched.

Streaming and media services

Services serving large live audiences rely on many replicas, spread across zones, with budgets that keep enough capacity during maintenance so that events are never interrupted by planned work.

Financial and regulated systems

Regulated firms must patch machines promptly and also keep services available. Budgets let them meet both duties: patch continuously, but never drop below the agreed capacity.

Shared platforms with many teams

Internal platforms provide templates that create a budget automatically with every new service, and policy rules that reject budgets which would block all maintenance. Teams get protection, and the platform team keeps the ability to patch.

i
Pattern to notice

In every setting, budgets sit at the boundary between two teams: the people who build applications and the people who maintain machines. They turn an informal request, “please be careful with my service”, into a rule that tools can follow.

29When a Drain Hangs: A Troubleshooting Path

Match the symptom to the likely cause, then work through the steps in order.

SymptomLikely causeWhat to checkTypical fix
Drain waits forever on one podThe budget allows zero disruptionsAllowed count and healthy count of the budgetRepair the unready pod, or loosen the rule
Eviction fails with a server error rather than a waitMore than one budget matches the podAll budgets in the namespace and their selectorsKeep a single budget per pod
Budget shows zero expected podsSelector matches nothingLabels on pods compared with the selectorCorrect the selector
Allowed count stays zero at normal sizeMinimum available equals replicas, or rounding upThe rule and replica count arithmeticLower the minimum, or add a replica
Replacements stay pendingNo spare capacity, or a disk tied to a zonePod events and node capacityAdd capacity, or fix storage placement
Allowed count bounces up and downFlapping readinessReadiness probe settings and pod eventsFix the probe or the application
Pods disappear despite a budgetDirect deletion or a crashWho deleted them, and node healthRestrict deletion rights, spread pods, and set resources
Autoscaler will not remove idle nodesProtected pods cannot moveAutoscaler reasons and budgets on those podsAdjust the rule or the pod spread
1

Read the drain output

It names the pod that cannot be evicted and often states that a budget is the reason.

2

Look at the budget’s status

Compare the expected, current healthy, desired healthy, and allowed numbers. Which one looks wrong?

3

List the application’s pods

Find any that are not ready, are stuck pending, or are crash looping. One such pod is usually the entire cause.

4

Check for overlapping budgets

List every budget in the namespace and compare selectors. Overlaps cause hard failures.

5

Confirm there is room to reschedule

Look at free capacity on other nodes and at any storage that ties a pod to one place.

6

Fix the cause, then retry

Repair the pod, add capacity, or correct the rule. The drain resumes by itself once the allowed count rises.

30Budgets on Managed Cloud Platforms

If your provider runs the control plane and upgrades your nodes, you should know how it treats your budgets.

Cloud providers that offer managed Kubernetes each have their own way of upgrading nodes. Broadly, they cordon a node, drain it while respecting budgets for some time, and then either move on or stop and report. The details, such as how long they wait and whether they can be told to proceed anyway, differ from one provider to another and change over time. Always read the current documentation of the service you use.

Question

How long will it wait?

Many services wait a fixed period for budgets to allow eviction, then take a different action. Know your provider’s limit.

Question

What happens at the limit?

Some stop the upgrade and report an error. Some proceed and remove pods anyway. Neither is a surprise if you have read the documentation.

Question

How many nodes at once?

Upgrade settings often control how many nodes are replaced together. More at once is faster and puts more stress on budgets.

Question

Are there maintenance windows?

You can often choose when automatic upgrades happen. Pick a quiet period so budgets and spare capacity are rarely tested at peak.

Question

What about surge nodes?

Some upgrades add extra nodes first, so evicted pods land on already-ready machines. This makes recovery faster and keeps budgets healthier.

Question

Do add-ons have budgets?

System components such as name resolution often ship with their own budgets. Do not remove or override them.

i
Practical hint

Ask your provider’s documentation two questions before your first upgrade: how long are budgets respected, and how can you see that an upgrade is waiting on one? Write the answers in your runbook.

31A Hands-On Walkthrough in Plain Words

Let us protect a small web service step by step, describing each action in words rather than code.

You run a product catalog service with six copies across three nodes. It needs at least four copies to handle normal evening traffic. You want to keep it safe during a node upgrade.

1

Decide what you can lose

With six copies and a need for four, you can lose two. To be gentle, you decide to allow only one at a time, so that a stray crash during maintenance does not push you below four.

2

Choose the style

Because the service scales between four and twelve copies, you choose “maximum unavailable of one”. It behaves the same at every size.

3

Write the budget

You create a budget object in the same namespace, with a selector matching the application label used by your pods, and the maximum unavailable set to one.

4

Verify the numbers

You inspect its status. Expected pods is six, current healthy is six, desired healthy is five, and allowed disruptions is one. Everything matches your plan.

5

Check readiness and spread

You confirm that the readiness probe reports ready only when the catalog data is loaded, and that a spread rule keeps two pods on each node.

6

Rehearse a drain in a test cluster

You drain a node holding two pods. The first is evicted, the second is refused until the replacement is ready, and then it follows. The drain takes a few minutes and users notice nothing.

7

Test the smallest size

You scale down to four copies and confirm that allowed disruptions is still one, so night-time maintenance is not blocked.

8

Add monitoring

You create an alert for the case in which allowed disruptions is zero for over thirty minutes, and another for a budget with zero expected pods.

9

Tell the platform team

You document the budget, the reasoning, and the expected drain time, so that the people who upgrade the cluster are never surprised.

What this walkthrough teaches

The order matters. First decide what loss you can tolerate, then write the rule, then check that the numbers agree with your intention, and finally rehearse. A budget you have never watched working is only a hope.

32Design Exercise: Sizing Budgets for Three Services

Practice makes the arithmetic automatic. Here are three services, each needing a different approach.

ServiceFactsRecommended budgetReasoning
Public web front endAutoscaled from 6 to 60 pods; stateless; quick to startMaximum unavailable 10 percentAt 6 pods it rounds up to 1, at 60 it allows 6. Maintenance stays fast at every size
Coordination clusterFive members; needs three for a majority; slow to catch up after restartMaximum unavailable 1Losing one at a time leaves four members, well above the majority, and gives each replacement time to catch up
Background report workerFour pods; jobs are retried if interrupted; short outages are acceptableMaximum unavailable 50 percent, or 2Interruptions are harmless, so faster maintenance is more valuable than caution
Payment processing APINine pods; strict error targets; slow warm-up of 60 secondsMaximum unavailable 1 with a minimum ready waitEvery disruption is costly, so proceed one at a time and wait for warm-up before counting a pod as ready

Reasoning about drain time

Consider the coordination cluster. If each replacement takes four minutes to become ready, upgrading five nodes, each holding one member, takes about twenty minutes at the very least, and only if the members are spread one per node. That is a good trade for a service where losing quorum would stop all writes.

i
Try it yourself

Pick one of your own services. Write down its smallest and largest number of pods, the minimum it needs to serve normal traffic, and how long a new pod takes to be ready. From those four numbers alone, you can choose a budget and predict how long a drain will take.

33Why Budgets Were Invented: A Short History

Understanding the problem that led to the feature makes its design feel natural.

In the early days of Kubernetes, clusters were smaller and maintenance was mostly manual. An engineer would drain a node, watch the pods move, and go on to the next node. If something looked risky, the engineer simply waited. The knowledge of what was safe lived in people’s heads.

As clusters grew to hundreds of nodes, and as upgrades became automated, that approach stopped working. Machines were now drained by scripts, by cloud services, and by autoscalers, none of which knew anything about the applications running on them. The application owners, on the other hand, had no way of telling those tools what was acceptable. The gap between “the people who know the application” and “the tools that move the pods” needed a formal language. The Pod Disruption Budget became that language.

The feature began as an early, experimental addition and matured over several releases into a stable, widely used part of Kubernetes. Along the way it gained better handling of percentages, support for more kinds of workloads, and, in newer versions, the option to decide what to do with pods that are already unhealthy. Its basic idea has hardly changed: a simple, written promise about how much can be missing at once.

Everyday analogy

Long ago, a small village bakery worked with a friendly rule everyone knew: never let the last two bakers leave at the same time. When the bakery grew into a large factory with hundreds of workers and automated shift schedules, the unwritten rule was forgotten. It had to be written into the scheduling system as a hard limit. The Pod Disruption Budget is that written rule.

1

Small clusters, careful humans

Maintenance was slow and supervised, and safety was a matter of experience.

2

Automation arrives

Scripts and services began draining nodes without any knowledge of applications.

3

A shared language is created

Application owners could now declare how much disruption they can tolerate.

4

Tools learn to respect it

Drain commands, autoscalers, and managed upgrade services began to check budgets.

5

Refinements over time

Better workload coverage, clearer status, and handling of unhealthy pods made budgets more practical.

34Related Ideas: Priority, Preemption, and Node Pressure

Three other ways pods can be removed behave differently from evictions requested by maintenance tools. Knowing them prevents confusion.

Preemption

Making room for important pods

When an important pod cannot be placed, the scheduler may remove less important ones to make space. The scheduler tries to respect budgets when choosing victims, but it is a best effort, not a guarantee.

Node pressure

Evictions by the node itself

When a node runs very low on memory or disk, the kubelet stops pods to protect the machine. These evictions are driven by resource pressure and do not consult budgets.

Taints

Removal after a taint is added

Marking a node with a taint that pods do not tolerate causes them to be removed after a short delay. This path also does not go through the budget check.

Requests

Quality of service classes

Pods with well-set resource requests are removed later under pressure than pods without them. Good requests reduce surprise evictions.

Removal pathWho decidesBudget consulted?
Drain or maintenance evictionAdministrator or automationYes
Autoscaler scale-downAutoscalerYes, it checks before removing a node
Scheduler preemptionSchedulerBest effort
Node pressure evictionKubeletNo
Taint-based removalNode controllerNo
Direct deletionA person or scriptNo
Everyday analogy

Think of a theater with a rule that at least three ushers must remain in the hall. The manager who asks an usher to step out must check the rule. But a fire alarm that sends everyone outside does not ask, and neither does a power cut. Some events follow the rulebook. Others simply happen.

!
Watch out

Because so many removal paths ignore budgets, teams who see pods vanish should not assume the budget is broken. First check which path removed the pod by reading the pod’s events and the node’s events.

35Testing Your Budgets Before They Are Needed

A safety rule proves its value only when it is exercised. Rehearsal turns a theory into a fact.

Many teams write a budget once and never see it work. Months later, during an upgrade, the first real test is also the first real failure. A little deliberate practice prevents that. The goal is not to break things but to learn, in a safe place, exactly how your application behaves when machines are emptied.

A simple rehearsal plan

1

Use a realistic test cluster

It should have several nodes, spread across zones if your production does, and run the same number of pods per node as production.

2

Generate steady traffic

Send a gentle, constant stream of requests to the service, so any dropped requests during the test are visible.

3

Drain one node

Watch how many pods are refused, how long replacements take, and whether the request stream shows errors.

4

Repeat at the smallest size

Scale the service down to its minimum and drain again. Many blocked drains only appear at this size.

5

Break something on purpose

Make one pod unready and drain again. The drain should wait, and you should see exactly how the budget numbers change.

6

Write down the results

Record drain times, refusal counts, and any errors. These numbers become your maintenance planning guide.

What a good rehearsal shows

  • Drains finish within the time you planned.
  • Request errors stay at zero or near zero.
  • Refused evictions clear by themselves as replacements become ready.

What a bad rehearsal reveals

  • A drain that never finishes, meaning the rule allows zero disruption.
  • Bursts of errors, meaning readiness or graceful shutdown needs work.
  • Pods stuck pending, meaning capacity or storage placement needs attention.
i
Practical hint

Some teams schedule regular “game days” where a random node is drained during working hours, with everyone watching. Problems found on a calm Tuesday afternoon are far cheaper than those found during an emergency.

36Governing Budgets Across Many Teams

In a large organization, hundreds of budgets are written by dozens of teams. A little governance keeps them consistent.

When only one team uses a cluster, budgets are a private matter. In a shared platform, they become a shared agreement. The platform team needs to patch machines on a schedule, while each application team needs its service to stay up. Both goals are legitimate, and they collide at the budget.

A simple set of shared rules

  • Every multi-replica service has one budget. Enforce this through templates and periodic reports.
  • Budgets must allow at least one disruption at normal size. A policy rule can reject budgets that make maintenance impossible.
  • Minimum replica counts must fit the budget. If a budget needs three healthy pods, the service should run at least four.
  • Stateful systems are reviewed by hand. Numbers for databases and brokers come from their own recovery rules, not from a general template.
  • Exceptions are recorded. If a team needs a stricter rule, they document why and set a review date.
  • The platform publishes its maintenance calendar. Teams know when nodes will be drained and can prepare.
Everyday analogy

In a large apartment complex, the maintenance office and the residents agree on notice periods: repairs are announced a week ahead, and residents may ask to reschedule but not to refuse forever. The budget is the written form of that agreement between residents and the office.

A common platform arrangement

Many platform teams provide a standard application template. When a team deploys a service through it, a default budget is created automatically, with a maximum unavailable of one for small services and a percentage for large ones. Teams may adjust it within limits set by policy, and reports flag any service that has multiple replicas but no budget.

37Frequently Asked Questions

Quick answers to the questions that come up most often.

Q1Do I need a Pod Disruption Budget for every application?
For any application with more than one replica that users depend on, yes. For throwaway or single-replica workloads, it is usually not helpful, and can block maintenance.
Q2Can I set both minimum available and maximum unavailable?
No. Only one of the two may be set in a budget. They express the same limit in two different ways.
Q3Does a budget protect me during a rolling update?
No. A Deployment’s rolling update is governed by its own settings for extra pods and unavailable pods. The budget applies to evictions, not to the Deployment’s own replacement of old pods with new ones.
Q4What happens if a node crashes?
The budget is not consulted. Pods on the failed node are lost, and their owners create replacements. Protection here comes from spreading pods and running enough spare copies.
Q5Why is my node drain stuck?
Most often a budget allows zero disruptions, because a pod is not ready, replicas are too few, or the rule is too tight. Check the budget’s allowed number, and then the state of the pods.
Q6Do percentages round up or down?
They round up. This means a high minimum-available percentage on a small group can require every pod to stay, blocking all voluntary disruption.
Q7Does deleting a pod bypass the budget?
Yes. A direct deletion does not go through the eviction check. Only evictions consult the budget.
Q8What is the difference between a drain and an eviction?
A drain is a whole operation on a node: cordon it, then evict every pod. An eviction is the polite request to remove one pod. The budget is checked at each eviction.
Q9How many pods should a budget allow to be disrupted?
One at a time is a safe default for small and stateful groups. Larger, stateless fleets can allow a percentage. Base the answer on how much capacity you truly need at the smallest size.
Q10Can a budget make my cluster more expensive?
Yes. If budgets prevent autoscalers from removing underused nodes, those nodes stay and cost money. Reasonable allowances and good spreading help.
Q11Should stateful databases have budgets?
Yes, usually with a maximum of one unavailable, tuned to the system’s majority rules. Also check that readiness reports ready only after a replacement has caught up with its peers.
Q12What if a pod is already unhealthy when I drain?
By default it may block the drain when the budget has no spare room. Newer Kubernetes versions offer an option that allows unhealthy pods to be evicted regardless. Check what your version supports.
Q13Is a budget the same as an anti-affinity rule?
No. A budget limits how many pods may be removed at once. Anti-affinity and spread rules control where pods are placed. Good designs use both.

38Summary and Key Takeaways

What to remember about Pod Disruption Budgets

  • A budget is a promise about planned maintenance. It limits how many pods of one application may be voluntarily removed at once, so drains, upgrades, and scale-downs stay polite.
  • It governs evictions only. Crashes, node failures, direct deletions, and Deployment rolling updates do not consult it, so spread and spare capacity remain essential.
  • Four numbers tell the story. Expected pods, current healthy, desired healthy, and disruptions allowed show exactly why a drain proceeds or waits.
  • Choose numbers with the smallest size in mind. Percentages round up and can freeze small groups. A maximum unavailable of one is a dependable default.
  • Readiness makes the count honest. A budget recovers only when replacements are truly ready, so good probes and graceful shutdown are part of the design.
  • Avoid the classic traps. Do not require every pod, do not protect a single replica, do not overlap selectors, and do not delete budgets to force an upgrade.
  • Watch it and rehearse it. Alert on long stretches of zero allowed disruptions, and practice drains before real upgrades, so the budget protects your users without blocking your team.