Blog

Draining Nomad clients: cordons, drains, and maintenance without surprise pending work

Dec 1, 2026 By Nomatron

How Nomad operators cordon and drain clients for OS patches, hardware replacement, pool shrinks, and bad-node isolation without surprise pending work.

Blog hero for draining Nomad clients, showing cordons and drains used to take clients out of service cleanly during maintenance.

Maintenance on a Nomad estate is eligibility and capacity work. It is not a packing flip, and it is not a job rewrite. Clients are taken out of the eligible set on purpose so OS patches, hardware replacement, pool shrinks, and bad-node isolation do not turn into surprise pending work.

This guide is written for operators who already place work with regions, datacenters, and node pools, and who already know that packing only ranks clients that remain eligible. Estate labeling is not re-taught here; see Structuring compute estates with Nomad regions, datacenters, and node pools. Packing geometry is not re-taught here either; see Nomad scheduling: binpack vs spread. The focus below is how cordons and drains shrink that eligible set cleanly.

A light continuity example is used throughout: on the order of 1,000 Nomad clients across EU, US, and APAC footprints, with a sensitive payments-prod band and a denser batch band. Continent names stay in ops language. Nomad’s region field still means the cluster. A datacenter remains a named scheduling domain inside that cluster.


Why maintenance takes clients out of the eligible set

Eligible clients receive new placements. Maintenance needs a controlled shrink of that set. While a client is still eligible, the scheduler treats it as a normal candidate. Work drained from a neighbor can land on it. New job updates can fill it. A host that looks “about to be patched” is still fair game until eligibility is changed.

Stopping a host without a drain or an eligibility change is a different operational path. Allocations disappear with the machine. Replacement timing follows failure and reschedule behavior rather than an intentional migrate window. That path is sometimes unavoidable. It is not the same as a deliberate maintenance sequence, and it should not be the default story for planned work.

On the continuity estate, the remaining-capacity story differs by band. Taking twenty clients out of a tight payments-prod pool removes a visible slice of headroom and can raise pending risk quickly if replacements have nowhere eligible to land. Taking the same count out of a denser batch band may look quieter on utilization charts while still moving queue depth if the remaining eligible set cannot absorb the displaced work. Concurrent drain batch size should be chosen from remaining capacity and pending behavior, not from the calendar alone.


Cordon vs drain

Diagram comparing a Nomad cordon, which freezes eligibility, with a drain, which empties a client deliberately.

Colloquial cordon maps to Nomad scheduling eligibility disable: nomad node eligibility -disable. The client stops receiving new placements. Existing allocations keep running. That freeze is useful before a multi-node drain, during inspection of a bad node, or whenever refill must stop without yet moving work.

Drain (nomad node drain -enable) also blocks new placements and begins moving or stopping existing work according to job type and drain deadline. Enabling drain marks the node ineligible. When a drain is disabled, eligibility is restored by default unless -keep-ineligible is set so the freeze survives cancel.

Cordon-only is enough when the goal is freeze without migration: hold a retirement class before any drain starts, keep a suspect client from refilling while logs and hardware are checked, or pause intake on a slice of capacity that should stay loaded until a change window opens. Drain is required when the client must be emptied: patch reboot, hardware pull, class retirement, or any maintenance that needs allocations off the machine before the host changes.

Operators often need both in sequence. Eligibility is disabled across the set that will leave service. Drains then empty that set one client or one controlled batch at a time. Replacements are verified healthy. Only then is eligibility restored on clients that should return to service.


Drain behavior: allocations, deadline, force, ignore-system

Drain behavior depends on what is running on the client.

Service allocations follow their migrate preferences until the drain deadline is reached. They are migrated rather than treated as a classic reschedule path; previous reschedule attempt state is not propagated onto the replacements the way a loss-driven reschedule would imply. Batch and sysbatch allocations are given time to finish, or they are stopped when the deadline arrives; they are not replaced as part of the drain. System allocations are stopped last by default and are not replaced by the drain path.

Deadline is the operator’s hard stop. The default is one hour. Remaining allocations after the deadline are removed from the node even when migrate preferences would have preferred a slower move. -no-deadline removes that default ceiling so work can leave on migrate or completion timing alone. -force removes allocations immediately, including system work unless -ignore-system is also set, and it is not a casual choice around CSI node plugins when volumes are not being detached by some external path.

-ignore-system lets the drain complete without stopping system job allocations. That is useful when system agents or plugins must stay up through the maintenance step, and dangerous when the host is about to disappear underneath them. Canceling the monitor with Ctrl-C does not cancel the drain. Drain cancel is an explicit -disable. When inspection or hardware hold still needs a freeze after cancel, -keep-ineligible keeps the client out of the eligible set.

Deadline choice is an estate policy decision, not a per-ticket improvisation. Short deadlines on payments-prod trade migrate politeness for a predictable maintenance ceiling. Longer or no-deadline drains on batch can wait for long-running allocations to finish when queue delay is cheaper than forced stops. Whatever policy is chosen should be written down, reviewed, and applied consistently across shifts.

Multi-node maintenance has one standing rule. Eligibility is disabled on every client in the retirement or patch set first. Only then are drains enabled. If clients are drained one by one while siblings remain eligible, replacements from the first drain land on the next machine about to leave service. Pending work and migrate churn multiply for no capacity gain. On a thousand-client estate that mistake is easy: the next rack or the next payments-prod slice still looks healthy in the UI until it becomes the accidental landing zone.


Day-two patterns

OS and kernel patch windows

The usual sequence is cordon the patch set, drain each client or each controlled batch, verify replacements healthy on remaining eligible capacity, patch and reboot, then re-enable eligibility. The cordon boundary is chosen from pool and datacenter labels that already define the band, not from a spreadsheet of hostnames that disagrees with Nomad’s eligible set.

Progress is watched at the batch boundary, not only at the end of the change window. After each drain batch, pending depth and replacement health are checked before the next eligibility slice is drained. A quiet first batch on batch does not license a full-rack concurrent drain on payments-prod in the same hour. payments-prod windows stay smaller and more serialized when headroom is thin. batch windows can often run wider concurrent drains when empty reclaim and queue depth are the binding signals rather than interactive latency.

Runbook details that teams argue about in the moment (deadline length, whether system jobs are ignored on reboot hosts, who may re-enable eligibility) belong in Git beside the estate change procedure. Ad-hoc chat guidance drifts across EU, US, and APAC shifts on a thousand-client estate.

Hardware replace and decommission

Drain to empty, confirm the client is clear, then remove the host from the estate. Keep the node ineligible after drain so it does not refill while disks are swapped or while the machine sits half-removed. Re-eligibility is only for clients that are meant to return. A decommissioned client should leave the eligible set permanently, not bounce back because a drain was cancelled with the default eligibility restore.

Hardware work also exposes inventory drift. If the host still appears eligible under an old pool or datacenter label after it was meant to leave service, replacements may target a machine that operations already treats as gone. Drain status and eligibility state are checked against the inventory source of truth before the rack ticket is closed.

Pool or class shrink

The same eligibility-first pattern applies when an entire class is retiring: old kernel line, old instance family, or a datacenter label being collapsed. Disable eligibility on the whole retiring class, drain in batches sized to remaining capacity, and refuse to treat “we drained the first ten and they look fine” as proof that the next ten can stay eligible while waiting.

Soft continuity with the packing post matters here only as texture. Binpack on batch may already show reclaimable empties, while spread on payments-prod may keep a wider active set, so the same headcount drain removes different shapes of remaining capacity. Packing is not retuned mid-shrink to invent headroom. If pending climbs because the remaining eligible set is too small, concurrent drain width is reduced or capacity is added to the surviving class before the next batch.

Bad node isolation

Cordon first when refill must stop and existing work can stay while the host is inspected. If the machine must be emptied, drain and keep it ineligible afterward. Stopping the Nomad agent or powering the host off is not equivalent ops hygiene for planned isolation. It collapses the migrate window into a failure path and surprises anyone watching pending and reschedule counters for a controlled maintenance signal.

A bad-node cordon that lasts longer than the inspection window needs an owner. Frozen capacity on payments-prod is still lost headroom. Either the client returns through a deliberate re-eligibility step after repair, or it is drained and removed. Leaving cordoned clients around as informal quarantine without a next action slowly trains the estate to lie about available capacity.


Interaction with packing, eligibility, and pending work

Diagram of an eligibility-first multi-node drain, showing clients cordoned before they are drained so replacement work does not land on a shrinking set.

Eligibility shrinks the candidate set. Packing only ranks what remains. A drain that removes capacity from a band can create pending allocations even when scheduler_algorithm is unchanged. That pending signal usually means remaining eligible capacity, datacenter or pool targeting, or other placement filters left too little room for replacements. It does not mean the drain “failed to try.”

Draining under spread versus binpack changes where replacements prefer to land inside the remaining set. It does not create free capacity. Flipping packing mid-drain to clear pending caused by an eligibility shrink confuses two different levers. Eligibility and capacity questions stay first. Packing questions stay second, and thin. Job constraints, affinities, and job-level spread are out of scope for this article; they belong to job authorship, not to the client maintenance sequence.

On the continuity estate, a payments-prod drain that leaves a narrow eligible remainder will show pending sooner than a batch drain that still has reclaimable clients under a densifying policy. The runbook response is to slow concurrent drains, widen the eligible remainder, or add capacity, not to treat packing as a maintenance escape hatch.


Monitoring and alerts during drains

Day-two watching during maintenance is a temporary capacity story. Useful signals sit together: drain status and ineligible count, allocation migrate or stop progress on the draining clients, queue or pending depth for the affected jobs and pools, and lost capacity versus band headroom. Node status that shows drain and eligibility state complements allocation views so a “quiet” pending chart is not trusted while a large ineligible set is open.

Alert intent follows that geometry. Pending rising while a large ineligible set is open is a capacity warning for the maintenance window. A drain stuck past deadline expectations needs operator attention before the deadline force-removes remaining work in a less orderly way than the migrate path intended. Replacements that are unhealthy before re-eligibility should block the return of drained clients to the eligible set.

payments-prod and batch should not share one maintenance alert folklore. A pending bump that is normal during a wide batch reclaim drain can be unacceptable during a serialized payments-prod patch window. Band-scoped views matter as much as cluster-wide pending totals.

Thresholds tuned for steady-state eligible capacity misfire during a wide cordon. Retune for the temporary shape of the window, then restore baselines when the set is eligible again. Prefer that day-two prose over a numbered docs checklist taped beside the pager. The runbook operators actually follow belongs in Git beside the other estate change procedures.


Anti-patterns

Draining node by node without cordoning the rest of the retirement set invites replacement churn onto soon-drained clients. Equating host stop or power-off with a controlled drain skips the migrate window and turns planned work into failure handling. Assuming drain implies zero downtime, or that migrate preferences always win past deadline, sets false expectations for service owners. Flipping packing mid-drain to “fix” pending caused by eligibility or capacity answers the wrong question. Re-enabling eligibility before replacements are healthy, or cancelling a drain without -keep-ineligible when inspection still needs a freeze, puts work back onto a client that is not ready to own it.


Closing

Cordon freezes eligibility. Drain empties deliberately. Multi-node maintenance is sequenced capacity work on the same ~1,000-client estate story used for labeling and packing: regions as clusters, datacenters as named scheduling domains, pools as intent bands, and drains as the way clients leave that eligible set without surprise pending work. Prefer Git for the runbook. Prefer eligibility-first batching sized to remaining headroom. Prefer honest pending signals over optimistic calendar batch sizes.

For how those labels are structured, see Structuring compute estates with Nomad regions, datacenters, and node pools. For how packing ranks the clients that remain eligible, see Nomad scheduling: binpack vs spread.

If you run Nomad and this is a problem you recognise, you can join the Nomatron early access programme here: https://nomatron.io/waitlist/

HashiCorp and Nomad are trademarks of HashiCorp. Nomatron is not affiliated with or endorsed by HashiCorp.