---
title: "Machines"
description: "Cordon, evacuate and drain a node safely, label it for leaders, time-slice it, prune its model cache, reset a card held outside opod, and clean remnants."
url: "https://opod.io/docs/control-plane-operate/machines/"
markdown_url: "https://opod.io/docs/control-plane-operate/machines.md"
section: "Operate"
last_updated: "2026-10-31"
---

# Machines

> Cordon, evacuate and drain a node safely, label it for leaders, time-slice it, prune its model cache, reset a card held outside opod, and clean remnants.

## In short

The **Machines** page acts on one node at a time: take it out for maintenance, keep leaders off it, share its cards in turns, free its model cache, or reset a card that something outside opod left full. An evacuate moves only opod's own workloads, through one verified rollout per endpoint, so endpoints keep serving. A drain also evicts other teams' pods, and only after you confirm the exact list.

## When you need it

- A machine needs a reboot, a driver update or a hardware fix.
- A node's disk is full of old model weights (alert `node.cache-low`).
- A card shows memory in use and nothing of ours on it (alert `gpu.held-outside`).
- Leaders and front doors should stay on cheap CPU nodes, or off one particular node.
- A node is gone for good and its Node object should go too.

## Do it

To take node `node-c` out for maintenance and bring it back:

1. **Preview the evacuate**

   ```bash
   export CP=https://cp.example.com
   export H="Authorization: Bearer $(kubectl -n opodcp get secret opodcp-admin -o jsonpath='{.data.token}' | base64 -d)"
   curl -s -H "$H" $CP/api/v1/nodes/node-c/evacuate/preview \
     | jq '{ours: (.ours|length), foreign: (.foreign|length), endpoints: [.endpoints[] | {name, workers, blocked}], leaders}'
   ```

   Every endpoint should have no `blocked` reason. A `blocked` endpoint has nowhere else to go: free capacity first.

2. **Evacuate**

   ```bash
   curl -s -H "$H" -X POST $CP/api/v1/nodes/node-c/evacuate | jq '{node, cordoned}'
   ```

   The node is cordoned at once. Each endpoint on it then moves in a rollout of its own; the leaders move last.

3. **Wait until nothing of ours is left**

   ```bash
   kubectl get pods -A -o wide --field-selector spec.nodeName=node-c -l opod.io/endpoint
   ```

   An empty list means every worker and leader has moved. **Activity** shows each rollout as a run.

4. **Do the maintenance, then uncordon**

   ```bash
   curl -s -H "$H" -X POST $CP/api/v1/nodes/node-c/uncordon
   ```

   The placer may use the node again. Nothing moves back by itself; the next placement or scale-up uses it.

## Check it worked

```bash
kubectl get node node-c -o jsonpath='{.spec.unschedulable}{"\n"}'
curl -s -H "$H" "$CP/api/v1/runs?limit=5" | jq -r '.[] | "\(.kind) \(.state) \(.endpointName)"'
```

After step 2 the first command prints `true`, and the runs list one rollout per moved endpoint, each `succeeded`. After step 4 it prints nothing (the field is unset). The **Machines** page shows the node's state and its holders.

## If it fails

| Answer                                            | Cause                                                                               | Fix                                                          |
| ------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| `E-LEADER-NOWHERE`                                | no other node may hold a leader                                                     | uncordon a node, or lift an `opod.io/leaders=avoid` fence    |
| An endpoint in the preview is `blocked`           | nothing else in the cell can hold its workers                                       | free capacity, raise the licence or quota, then evacuate     |
| `E-DRAIN-CONFIRM`                                 | the foreign pods changed since the preview, or the token is older than five minutes | read the preview again and send its new `confirm`            |
| A drain is refused while `rbac.nodeDrain=false`   | the release has no cluster-wide eviction right                                      | evacuate instead, and drain the rest with `kubectl drain`    |
| `E-NODE-READY` or `E-NODE-HOLDS-OURS` on a remove | the node is Ready, or still runs our pods                                           | cordon and evacuate first; remove only a NotReady node       |
| `E-SHARING-BUSY`                                  | something holds the resource the switch takes away                                  | move the workers off the node first                          |
| `E-CARD-BUSY` on a card reset                     | a process is on the card                                                            | stop it first                                                |
| A cache prune Job stays `Pending` on a full node  | the kubelet rejects it under DiskPressure                                           | `--set priorityClasses.nodePressure=system-cluster-critical` |

## Node actions in detail

The **Machines** page and `/api/v1/nodes/{name}/…` act on one node at a time. Every action needs the admin role and touches only objects the control plane owns, except a confirmed full drain.

## Cordon and uncordon

`POST /api/v1/nodes/{name}/cordon` and `…/uncordon` set `spec.unschedulable` only. Nothing running moves; the placer skips a cordoned node, and a plan that names it is refused `E-NODE-CORDONED` with alternatives.

## Evacuate: move our workloads off a node

```bash
curl -s -H "$H" https://cp.example.com/api/v1/nodes/node-c/evacuate/preview | jq '{ours, system, foreign, endpoints, leaders}'
curl -s -H "$H" -X POST https://cp.example.com/api/v1/nodes/node-c/evacuate
```

The preview sorts every pod on the node into exactly one list:

| List      | What                                                                                        | An evacuate |
| --------- | ------------------------------------------------------------------------------------------- | ----------- |
| `ours`    | our endpoint and job workloads, by label, inside our namespace                              | moves them  |
| `system`  | ours but not a workload: the control plane's own pod, the telemetry DaemonSet, a helper Job | leaves them |
| `foreign` | everything else                                                                             | leaves them |

`endpoints[]` says which endpoints would move and which are `blocked` (nothing else in the cell can hold them). An evacuate cordons the node, then runs **one verified rollout per endpoint** with the node excluded, checkpoints and re-queues preemptible jobs, and finally moves the leaders the node hosts. A leader moves by deleting its pod once that endpoint has no rollout running, so its workers have moved first; it costs that endpoint a few seconds of `503` until the new leader is Ready, unless the endpoint has front doors. If no other node can hold a leader, the evacuate is refused up front with `E-LEADER-NOWHERE`.

A worker on a GPU-less node is re-pinned to the least loaded other GPU-less node.

## Drain: also evict the owner's pods

`POST /api/v1/nodes/{name}/drain {"confirm": "<token>"}` evacuates, then evicts the `foreign` pods, then our `system` pods. The `confirm` token comes from the preview and is bound to the node and to the foreign pods it will evict: if one of those appears or leaves, the drain is refused `E-DRAIN-CONFIRM` and you read the preview again. The token is good for five minutes. DaemonSet pods, finished pods and mirror pods are left, as `kubectl drain` leaves them.

`--set rbac.nodeDrain=false` removes the cluster-wide eviction right: evacuating our own workloads still works, and a full drain is refused.

## Labels for leaders and doors

```bash
opodcp node label node-a opod.io/leaders=avoid        # never a leader or a door here
opodcp node label node-c opod.io/leaders=prefer       # picked first
opodcp node label --remove opod.io/leaders node-a
opodcp nodes                                          # the fence, and the leaders and doors on each node
```

Or `PATCH /api/v1/nodes/{name}/labels {"opod.io/leaders": "avoid"}` (`null` removes). Only `opod.io/*` labels may be changed. See [Configuration → Where leaders and front doors run](https://opod.io/docs/control-plane-install/configuration/).

## Time-slice an NVIDIA machine

`POST /api/v1/nodes/{name}/sharing {"mode": "timeslice"}` (or `"budget"` to return) makes NVIDIA's plugin present each card as turns (`nvidia.com/gpu.shared`). The turn count per card comes from the node label `opod.io/gpu-slices` and the chart's `substrate.nvidiaDevicePlugin.timeSlicing.choices` (`2`, `4`, `8`; default `4`). Refused `E-SHARING-VENDOR` on a non-NVIDIA node and `E-SHARING-BUSY` while anything holds the resource the switch takes away. Memory is not isolated between turns.

## The model cache

```bash
curl -s -H "$H" "https://cp.example.com/api/v1/nodes/node-c/cache?minAge=24h"          # preview
curl -s -H "$H" -X POST "https://cp.example.com/api/v1/nodes/node-c/cache/prune?minAge=24h"
```

The preview runs core's `opod cache prune` as a dry run in a short Job and deletes nothing. It keeps every file a plan with a worker there references (parked ones included), every file a prefetch is pulling now, and every model with a `staging` or `prod` version. The alert `node.cache-low` links to it.

A node whose cache filled its disk carries DiskPressure, and the kubelet rejects any pod it does not read as critical, including the prune. Set `priorityClasses.nodePressure=system-cluster-critical` so the prune and the probe can run there.

## A card held outside opod

A card with at least 1 GiB in use and nothing of ours on it is **held outside**: it is not free in the ledger and raises `gpu.held-outside`. When you know the memory is stale:

```bash
curl -s -H "$H" https://cp.example.com/api/v1/nodes/node-c/gpus/0/reset          # what a reset would do
curl -s -H "$H" -X POST https://cp.example.com/api/v1/nodes/node-c/gpus/0/reset
```

The node is cordoned for the reset (and uncordoned after when this made the cordon), the driver is asked again for processes, and `nvidia-smi --gpu-reset` runs in the probe pod. The preview answers `200` with the plan, and its `code` and `refusal` when a reset would be refused. The reset itself is refused `400 invalid` with `details.code`: `E-CARD-NOT-OUTSIDE` (a card of ours), `E-CARD-BUSY` (any process on it, whoever's), `E-CARD-RESET-UNSUPPORTED`. **(planned)** Card reset on AMD, Intel and Tenstorrent.

## Remove a dead node

`DELETE /api/v1/nodes/{name}` removes the Node object of a node that is NotReady and holds nothing of ours. A Ready node is refused `E-NODE-READY`; a node that still runs our pods is refused `E-NODE-HOLDS-OURS`.

## Remnants

The janitor runs every minute and finds what nothing owns any more: objects of deleted endpoints, Jobs and pods of finished runs, a pod on a lost node, old terminated pods, stale partial weight downloads. It cleans the safe ones by itself, each clean a run of kind `cleanup`. The **Activity** page lists them under **Remnants**.

```bash
curl -s -H "$H" "https://cp.example.com/api/v1/remnants?all=true"
curl -s -H "$H" -X POST https://cp.example.com/api/v1/remnants/<id>/clean
```

A pod on a lost node cordons that node while it is open. Cleaning it says the machine is gone or the card is free, and lifts that cordon.

## Health fencing

A card with uncorrected ECC errors or an active hardware slowdown is fenced for new placements and raises `gpu.unhealthy`. By default nothing running is stopped.

**(arrives in the release after 0.3.6)** **Move our workers off an unhealthy card.** Turn on the cell policy `health.autoCordon` (admin; default `false`):

```bash
curl -s -H "$H" -X PUT $CP/api/v1/settings/health -d '{"autoCordon": true}'
curl -s -H "$H" $CP/api/v1/settings/health          # {"autoCordon": true}
```

When a card reads unhealthy in two probe readings in a row (about 40 s), the control plane moves every endpoint that has workers on that card's node off it, by a verified rollout signed `health-cordon`: the new worker is placed, prefetched and smoke-tested before the old pod goes. One unhealthy reading does nothing, and a healthy reading starts the count again. The node itself is never cordoned: other workloads on it are not ours to touch. An endpoint's last ready worker (or gang) is never moved. It stays, and the `gpu.unhealthy` alert names it: add a worker on another node and it moves on the next pass.

**Check it worked:** the machine page shows *auto-cordoned* on the card, with the reason, since when, what moved (with the run) and what was kept and why. `GET /api/v1/nodes` carries the same facts as `autoCordon` on the card. The events are `gpu.auto-cordoned`, `gpu.auto-cordon-kept` and `gpu.auto-cordon-cleared`.

**If it fails:** a kept endpoint says why: a run already holds it (it is tried again when that run ends), no other node can take it, or its move failed once (move it by hand with Edit plan & roll). The record ends when the card reads healthy, leaves the fleet, or the policy is turned off. Nothing that was moved is moved back.

**Drill:** to rehearse it without a faulted card, set `OPODCP_DRILL_GPU_UNHEALTHY=node-a/0` (node name / card index, comma-separated) on the control plane's Deployment. That restarts the control plane, the setting is gone on the next `helm upgrade`, and the reading says it was forced.

**(planned)** GPU profiling counters and Xid events (from DCGM) and CPU pinning of workers.
