Opens in a new tab
Guide

The pod may leave. Who answers its requests while it is gone?

In brief

A Kubernetes disruption budget can permit maintenance while the remaining model servers struggle. Follow the replacement from eviction through GPU placement, model loading and its first useful answer.

7 min read

Is this the right starting point?
Before you read
Practical Kubernetes administration, workload scheduling and inference-serving experience; authorized staging drain access is needed for the exercise.
What you will take away
Design and inspect a bounded inference-maintenance trial that separates pod availability from serving capacity and recovery.
Sources
Two filled teal parcel boats remain at a dock while a third is lifted out and parcels wait beside its empty berth.
On this page6 sections

The maintenance step is allowed, one worker leaves, and the remaining model servers start falling behind. Its replacement is still loading the model. To the people waiting for answers, permission to remove the worker was not the same thing as having enough capacity without it. Kubernetes can limit how many pods, the units running the application's containers, become unavailable. The maintenance plan has to follow the requests as well.

A useful rehearsal keeps those requests coming while the replacement starts. Define the mix of work and the observation window, plus a stop condition and a recovery route. The canary guide uses the same idea of a bounded comparison; here the change is temporarily taking a worker out. What happens to service during that interval determines whether the next maintenance step is reasonable.

Two remaining replicas can still be one too few

A PodDisruptionBudget, usually shortened to PDB, limits availability loss among selected pods when planned removals go through the Eviction API. That interface checks the budget before allowing an eviction. It does not reserve a replacement GPU or prevent involuntary failures, although those failures count against the allowance. Rolling updates follow the workload controller's own rules. Kubernetes' disruption model explains where these protections begin and end.

That separate control matters when a rollout and host maintenance happen together: both can obey their own policies while reducing the same serving capacity. For this pilot, pause unrelated rollouts, identify other maintenance automation and record the exclusion period. Then the observed change has a chance of describing one operation rather than several overlapping ones.

Take a hypothetical pool of three Ready replicas, three copies of the serving application. Each sustains 20 requests per second within the response-time limit, and 50 arrive each second. A rule requiring two pods permits one removal, leaving assumed capacity of 40. Ten requests each second now have to wait, fail or go elsewhere. These are illustrative rates, not measured performance; prompts, output length and batching change real capacity. The pod count can be correct while the queue grows.

Three illustrative replicas provide 60 requests per second. One permitted eviction leaves 40 against demand of 50. Eviction permission and service acceptance are separate checks.
Illustrative three-replica arithmetic: 60 requests per second becomes 40 after one permitted eviction, against 50 arriving. The pod-count rule does not establish that the remaining service meets its objective.

Rehearse the wait with a believable spare

Those ten requests give staging a concrete question: how long until the replacement can help? Use a model size, startup path and placement constraints resembling the intended service, with synthetic inputs instead of customer content. Permission to inspect the cluster is not permission to drain a node. Before starting, observers and the authorized operator need agreed load, response-time and rejection ceilings, a duration and a recovery owner.

The arithmetic assumes each replica can answer independently. A distributed model may split one request across cooperating processes, called ranks. Removing one can interrupt their joint work rather than subtracting a single independent server. Training can also lose progress not yet saved in a checkpoint. When that loss is intolerable, use the workload's coordinated shutdown or checkpoint route; replica count cannot supply it.

A spare GPU helps only when it can actually be obtained in time. Include its funding and acquisition delay alongside the trial's bounded GPU, download, warmup and logging costs. An idle spare waiting in staging can make replacement look easy while concealing the delay production would face.

Make sure the budget names this application

This manifest assumes an existing three-replica Deployment with app: inference-api in the inference namespace. It allows one selected replica to be unavailable. It neither creates replicas nor scales the application, so inspect the actual template labels before relying on the selection:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: inference-api-maintenance
  namespace: inference
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app: inference-api

Use either minAvailable or maxUnavailable, not both. Integers are often easier to picture for a small group; percentages round upward. An empty policy/v1 selector matches every pod in the namespace, much more than the application name above suggests. The PDB guide describes that selection and the resulting status.

kubectl -n inference get deployment inference-api -o yaml
kubectl -n inference get pods -l app=inference-api -o wide

After reviewing the selection, save the file as inference-pdb.yaml. In approved staging, inspect kubectl diff -f inference-pdb.yaml and apply only the intended selection and allowance. Read the live budget before draining, rather than assuming the saved file describes the current policy:

kubectl -n inference get pdb inference-api-maintenance -o yaml

Compare currentHealthy, desiredHealthy and disruptionsAllowed, and check that status reflects the specification. A zero allowance may point to unhealthy pods, the wrong selection or a replacement that is not ready. Removing the budget would silence that objection without producing another healthy server.

A free GPU can still be the wrong home

Suppose a GPU is free and the replacement is nevertheless waiting. It may be the wrong type, lack requested resources or usable storage, or fall outside the required network arrangement. Taints mark nodes to exclude pods without the corresponding toleration; affinity rules express required or preferred placement. The assignment guide describes these constraints. Free hardware and hardware eligible for this pod are different things.

There may also be two replicas on the worker being drained. The budget can let the first leave and block the second until a replacement becomes healthy. That pause can be the policy working as intended while making slow recovery visible.

Placement is only part of the wait. The replacement may still need to retrieve its image, load the model and warm up. Running does not mean it has answered its first useful request. Measure those intervals separately and choose readiness checks that reflect usable inference without uncontrolled costly probes. The probe guide distinguishes startup, liveness and readiness, which answer different questions about the container.

Keep counting the requests that do not finish

Offer the same workload while the worker leaves, including requests the service may reject. In the illustrative 50-request-per-second case, a graph showing only accepted completions could quietly omit the ten the remaining replicas cannot finish. Response time, rejection, queue age and Ready replicas help account for them. Preserve request identity across retries so another attempt is not counted as another customer task. Check the load generator's limits too: a stalled generator can hide missing service capacity.

Once the baseline and target are confirmed, the authorized operator can drain the approved staging worker. Substitute its verified name, not a production node chosen to make the example convenient:

kubectl drain <approved-staging-node> --ignore-daemonsets --timeout=10m

Suppose the ten-minute timeout arrives while the replacement is loading. The command's failure exit does not mean nothing changed; an earlier eviction may already have removed capacity. The timeout limits waiting, not effects already performed. The drain procedure uses graceful eviction and respects the budget, while leaving DaemonSet pods, the pods managed across nodes by a DaemonSet. Success does not mean completely empty, just as failure does not mean unchanged.

The tempting escape flags change the operation. --disable-eviction uses deletion and bypasses the budget. --delete-emptydir-data permits loss of local data; --force permits removal of pods without a controller. Consult the reference before considering them. They require review against the authorized experiment, not addition merely because a drain is taking longer than hoped.

Before another worker leaves, ask what happened under the same offered load. Is the replacement answering, is the queue growing, or is rejection rising? A stop condition means no further maintenance while scheduling events and service measurements are preserved. Together they distinguish delayed eviction, placement, startup and insufficient surviving capacity. Clearing the queue by rejecting its requests is not recovery for those callers.

Letting a node accept work again is not an undo button

If the original worker is healthy and its owner permits its return, kubectl uncordon <approved-staging-node> allows new scheduling there. It does not return evicted pods, reverse updates or move current pods back. Recheck placement and service after the change; if the host remains suspect, follow the approved replacement route instead.

An unhealthy pod blocking eviction may need an explicit policy decision. Kubernetes recommends considering AlwaysAllow for misbehaving applications. Review that choice for this version and workload: it trades waiting for the unhealthy running pod to recover for permission to evict it. That is a real recovery tradeoff, not simply a way to make the command finish.

The worksheet keeps the selection, baseline, interruption, recovery and next decision together. Carry forward only the conditions actually exercised. If available spare GPUs made staging work but production cannot obtain them, resolve that difference before treating the rehearsal as permission to proceed.

Come back to those ten requests each second. Put their completions, waits and rejections beside the interval from eviction to the replacement's first useful response. Now maintenance has an account of where the work went. If the capacity is insufficient, discovering that in a bounded rehearsal is far better than leaving the people in production to discover it for you.

Sources & context

Sources linked in this article. Read alongside the author’s analysis; a citation does not independently verify a publisher’s claims.

Report an error or outdated detail

Keep reading

Where to go next