Add a machine to a running cluster, or take one out, without tearing the cluster down and installing it again. Toolkit Manager does this with Kubespray's own scale.yml (add) and remove-node.yml (remove) playbooks. Kubespray is the tool that built the cluster in the first place.
Note: ADVANCED OPERATION: PROCEED ONLY IF YOU KNOW WHAT YOU'RE DOING — always run with
--dry-runfirst.
There are two commands. Neither takes a node name: you describe the cluster you want in env/<name>/nodes.yaml (on a rack-scale env, in rack-profile.yaml: see Rack-scale), and the command works out the difference.
| Action | Kubespray playbook | Scope |
|---|---|---|
add-node |
scale.yml |
Worker nodes only |
remove-node |
remove-node.yml |
Worker nodes only |
A worker node runs your workloads (models, services). A control-plane node runs the cluster itself (API server, etcd); these commands never add or remove one.
The workflow is always the same:
- Edit
nodes.yaml: add a worker entry, or delete one. - Run the command with
--dry-run. It comparesnodes.yamlwith the nodes the cluster reports (kubectl get nodes), prints the node(s) it would add or remove, and changes nothing. - Run the command again without
--dry-run, and answeryat the prompt.
One kind of change per edit. add-node refuses while nodes.yaml is missing a node that is in the cluster, and remove-node refuses while it lists a node that has not joined, so an edit that both adds and removes nodes is refused by both. Revert one half, run that command, then reapply the other half and run the other one.
./toolkit_manager.sh add-node --dry-run --env <name> # preview after editing nodes.yaml
./toolkit_manager.sh add-node --env <name> # scale in the new worker(s)
./toolkit_manager.sh remove-node --dry-run --env <name> # preview after deleting entries
./toolkit_manager.sh remove-node --env <name> # remove the dropped node(s)--env defaults to local. --force skips the y/N prompt. --skip is refused by both commands.
Check these before you run either command:
- The cluster was installed by Toolkit Manager. Both commands need
env/<name>/kubeconfig.yaml, whichinstall kuberneteswrites. Without it they stop and tell you to install the cluster first. - The installer host reaches the API server at
https://<control-plane-ip>:6443, not only the nodes over SSH. Without that access, both stop before Kubespray runs. - The installer host can SSH to the new node with the node's
ssh_user/ssh_keyfromnodes.yaml(or the file-widenodes_ssh_user/nodes_ssh_key), without a password prompt.add-nodetests this before it asks you to confirm. If it fails, authorize the key (for example withssh-copy-id) and retry. - ERAG is not deployed (see What's not supported).
| Scenario | Supported? |
|---|---|
| Installer-managed cluster, no ERAG deployed | Yes |
Adding worker node(s) via add-node |
Yes |
A control-plane node that is also a worker (an identical entry under both nodes_control_plane and nodes_workers) |
Yes, as long as it stays in both lists — add-node/remove-node treat it as control-plane: changing its role (worker on/off) is not something they do, and deleting it from both lists is a control-plane removal (refused) |
Removing worker node(s) via remove-node |
Yes |
| Scenario | Why |
|---|---|
BYO cluster (existing_kubernetes set in global_config.yaml) |
A bring-your-own cluster is not managed by Kubespray at all |
Adding control-plane/etcd node(s) via add-node |
Kubespray's scale.yml cannot add control-plane/etcd members |
Removing control-plane/etcd node(s) via remove-node |
Refused: see Control-plane nodes are not removed |
| Cluster with ERAG deployed | Both actions only ever touch the kubernetes component — ERAG's own Helm/pipeline config is never re-applied, so any node-specific placement it relies on isn't accounted for. Both refuse when any ERAG-only namespace (rag-ui, chat-history, edp, fingerprint, vdb, erag-gateway, auth-apisix) exists |
Hand-edited inventory (env/<name>/inventory/hosts.yaml, no nodes.yaml) |
Both actions find their target node(s), SSH details and control-plane membership from nodes.yaml; without it they stop before doing anything. Convert the inventory to nodes.yaml first |
Star racks (topology: star) |
The spokes reach each other through the hub, so a spoke added or removed changes the hub's fabric and every spoke's routes. Both refuse a star rack before doing anything |
| On a rack: control-plane, etcd or storage nodes, and an edit that changes the nodes that stay | See Rack-scale |
add-node with storage_backend: local-path, or custom with storage_custom_rwx: false |
Both serve a single node: the storage check refuses them on more than one, so every later install, validate and teardown would stop. add-node refuses them up front; move the env to NFS or Ceph first |
add-node when the control plane in nodes.yaml is at a loopback address (localhost, 127.x, ::1) |
A new node cannot reach a control plane at that address. Give the control plane its real IP in nodes.yaml |
add-node when the control plane has no NoSchedule taint and is not listed under nodes_workers |
An untainted control plane is this cluster's worker; adding the first entry under nodes_workers would quietly end that. To keep it a worker, list it under nodes_workers too (an identical entry) |
add-node when kubespray_extra.yml or kubespray_extra_auto.yml sets kubelet_config_extra_args |
It would override the add-node-pending registration taint add-node relies on. Move those settings out of the file first |
| Per-node setup of other components on a new node | add-node runs only the kubernetes component (plus NFS exports and NRI balloons; on a rack also the node's fabric, BGP peers, labels and GPU stack, see Rack-scale). A new node is not made a Ceph OSD node, does not get NetApp Trident's NFS client packages, and is not marked eligible for Kata. Re-run install for rook_ceph_storage, netapp_trident_csi or kata_containers if the new node needs them |
-
Append entries to
nodes_workersinenv/<name>/nodes.yaml:nodes_workers: - ip: 10.0.0.22 hostname: worker3
ipandhostnameare required.hostnamemust be lower case: it becomes the Kubernetes node name, and the command refuses upper-case names. Addssh_user/ssh_keyonly if they differ from the file-widenodes_ssh_user/nodes_ssh_key. -
Preview. The dry run lists the new node(s), checks SSH to them, and prints the
scale.ymlcommand it would run:./toolkit_manager.sh add-node --dry-run --env <name>
-
Apply, and answer
yat the prompt:./toolkit_manager.sh add-node --env <name>
-
What
add-nodedoes, in order:- Diffs
nodes.yamlagainst the live cluster to find the new node(s), and checks SSH to them. - Regenerates the inventory, then runs a pre-flight on the new node(s): not already joined, no Docker, API server and internet reachability (see Safety).
- Computes their kubelet CPU reservation, then runs Kubespray
scale.ymlfor just the new node(s) and the control plane. - Finishes the node(s): the
workload-classlabel (whennode_topology_enabledis true), the NFS export (onstorage_backend: nfs), a wait forReadyand for the node's DaemonSet pods (calico-node, kube-proxy, ...), and, when CPU pinning is on (kubernetes_cpu_policy: nri-balloonson a CPU cluster), the node's ownnode.<NAME>BalloonsPolicy. Existing nodes and running models are not touched.
Success ends with
Added and Ready: <node>and the node showsReadyinkubectl get nodes.New nodes join with an
ei.intel.com/add-node-pending:NoScheduletaint that is removed only after the last step, so nothing is scheduled on a half-configured node. If a step fails, re-runadd-nodeto resume: it runsscale.ymlagain for the tainted node, then the post phase. The taint stays in the node's kubelet configuration until Kubespray renders it again: if its Node object is deleted and the kubelet registers it again, it comes back tainted, andadd-nodelifts it the same way. - Diffs
Kubespray's scale.yml cannot add control-plane or etcd members: that needs a full cluster.yml run with the new host appended to the end of nodes_control_plane. add-node refuses a new entry under nodes_control_plane.
Kubernetes does not move running pods onto a new node. Models already deployed stay where they are; only new or restarted pods can be scheduled on it. To use the new node:
- Deploy new models, or undeploy and redeploy an existing one (
./model-manager undeploy <model>thendeploy <model> --wait). - To put a model on the new node, deploy it with
./model-manager deploy <model> --node <name>.--nodeis optional, but when you give it, it is a hard rule: the pod runs on that node or staysPending. Check where a pod runs withkubectl get pods -n llm-inference -o wide.
On a rack-scale env (rack_scale_enabled: true) the nodes come from env/<name>/rack-profile.yaml; nodes.yaml stays empty, and where this page says nodes.yaml, read rack-profile.yaml. Add the worker under its rack in rack-profile.yaml, or delete it from there, then run add-node or remove-node as above. Clos, L2 and none racks are supported, star racks are not. The node's key under racks is its Kubernetes node name.
- Workers only. A new or removed node with the
kube_control_plane,etcdorstoragerole is refused, an etcd-only node included: these actions change neither the etcd members nor Ceph's nodes, OSDs and mons. Adding or removing such a node needs a reinstall. - The nodes that stay must not change. The installer parses the edited profile and compares what it generates for the nodes already in the inventory (their inventory entry and groups, netplan and BGP peer files) and for the whole rack (Calico and Ceph settings) with what is on disk. Any difference, such as a new leaf, a different MTU or a changed role, is refused:
add-nodeandremove-nodebring up or take down the changed node's fabric only. Apply such an edit to every node withinstall infrastructureinstead. add-node, beforescale.yml: runs the checks above and the already-joined and Docker checks, then writes the inventory and the fabric files fromrack-profile.yamland applies the fabric netplan and sysctls, so a refused node is neither in the inventory nor has its network changed (the nodes already in the cluster get the files they already have, so nothing changes there). The API server check goes to the control plane's fabric address when the control plane is on the fabric. After the join: the BGP peers and the CPU/GPU labels fromrack-profile.yaml, then the steps above. On a BGP rack the leaf must accept the new node's BGP session, or calico-node stays not Ready and the node keeps its pending taint. Ifadd-nodefails after it wrote the inventory, the node stays there (on a Clos or L2 rack with its fabric up): re-runadd-nodeas it is, or take the node out ofrack-profile.yamland runremove-nodebefore you add it back changed.- A new NVIDIA GPU node gets the GPU stack after the pending taint is lifted, since the operator's DaemonSets do not tolerate it. The operator takes a new GPU node by itself, and
add-nodewaits, up to 30 minutes per node, until the node's GPUs are allocatable (nvidia.com/gpu). On a rack that had no NVIDIA GPU node at install, or without the platform layer, there is no GPU operator yet:add-nodesays so, andinstall platforminstalls it (with the GPU dashboards and alerts). remove-node, afterremove-node.yml: removes the node's fabric netplan (not with--node-lost) and deletes its BGPPeers, then regenerates the inventory fromrack-profile.yaml. The fabric sysctl file (/etc/sysctl.d/99-fabric-ecmp.conf) stays on the removed node. On a BGP rack, delete the node's neighbor on the leaf yourself.- A rack installed by an earlier release has no Python interpreter pin in its inventory, and
remove-nodeneeds it when the node and the control plane run different Ubuntu releases: runinstall infrastructureonce, before you take the node out ofrack-profile.yaml.
-
Delete the entry from
nodes_workersinenv/<name>/nodes.yaml. -
Preview. The dry run lists the node(s) to remove and the workloads on them, runs every check below (PodDisruptionBudgets, the preflight simulation with the node each evicted pod would land on), and prints the
remove-node.ymlcommand. It changes nothing:./toolkit_manager.sh remove-node --dry-run --env <name>
-
Apply, and answer
yat the prompt:./toolkit_manager.sh remove-node --env <name>
-
Before anything runs, the installer lists any real workload pods (excluding DaemonSets and static/mirror pods) running on the node(s) about to be removed — so you know what the drain is about to evict before you confirm. Then Kubespray's
remove-node.ymldrains, resets, and removes the node from the cluster. After that the installer deletes the node'snode.<NAME>BalloonsPolicy, regenerates the inventory without it, takes it out of the NFS exports (onstorage_backend: nfs, so the removed machine loses its access to the share), and deletes itshost_varsfile.Success ends with
remove-node: <node> removed; no new health findings.remove-node: node(s) to remove: worker1 WARN: worker1 is running workload(s) that will be evicted: - default/my-model About to run Kubespray remove-node.yml for: worker1 — this drains, resets, and removes those node(s) from the cluster. Proceed? [y/N]If the workload has no
PodDisruptionBudget, the drain evicts it immediately — check what's listed before confirming. A pod without a controller (markedno controller) is deleted, not moved: nothing recreates it. Before that, a simulation refuses the removal outright (see Preflight simulation below) if evicting these pods would leave a workload with nowhere to go — this is where "the only place a model happens to be running" is actually caught, not just displayed.If the node being removed is the last worker, a second warning fires — it checks whether the control-plane node currently carries the standard
NoScheduletaint (it does if the cluster was ever provisioned multi-node from the start; it doesn't if it started single-node and workers were added later viaadd-node, since kubeadm only sets that taint at cluster bring-up, not on a lateradd-node/scale.ymlrun). Tainted means nothing will be schedulable anywhere until a worker comes back; untainted means the cluster just drops to single-node capacity, which is a supported topology on its own.
remove-node refuses a node listed under nodes_control_plane. Every control-plane node is also an etcd member: remove-node.yml takes it out of etcd, but Kubespray's own procedure also needs cluster.yml re-run and --etcd-servers checked on every remaining control-plane node, and each node's nginx-proxy would keep the removed API server. Kubespray also stops on an even etcd count, and cannot remove the first control-plane node at all.
For a node that is unreachable or NotReady, use:
./toolkit_manager.sh remove-node --node-lost --env <name>This skips the PodDisruptionBudget check, gives the drain up after 60 seconds instead of waiting for pods that can no longer stop, and does not reset the node's OS (allow_ungraceful_removal=true, drain_timeout=60s, reset_nodes=false). Every target must actually be NotReady, so the flag can't be used to skip the drain on a healthy node. The capacity simulation still runs.
- Standard preinstall checks run against the new node(s) the same as any Kubespray play — OS/fact gathering,
kube_service_addresses/kube_pods_subnetCIDR validation, proxy config sanity checks in/etc/apt, etc. - No support for adding control-plane/etcd members —
scale.ymlonly onboards workers; see Control-plane nodes are not supported byadd-nodeabove.
Before scale.yml ever runs, against just the new node(s):
- SSH reachability — the installer connects with the credentials in
nodes.yaml(rack-scale:rack-profile.yaml) before the confirm prompt (and before--dry-runexits). - Not already joined to a cluster — fails if
/etc/kubernetes/kubelet.confalready exists on the node, rather than letting a stale or foreign join corrupt either cluster. - No Docker installed — fails if the node has a
docker.serviceunit, running or not. Kubespray removes any container runtime other than containerd: it kills and deletes every Docker container, uninstalls Docker and deletes/var/lib/dockerand/etc/docker, so all images, volumes and container data are lost. This installer never lets that happen. Back up and uninstall Docker yourself, or use a different node.install kubernetesruns the same check against every node (and the controller itself in single-node localhost mode) when it provisions a new cluster; on a running cluster Kubespray does not run, so it skips the check. - Duplicate hostname/IP within
nodes.yaml— checked even earlier, as part of inventory generation (applies toinstall/remove-nodetoo, not justadd-node): fails if two different entries acrossnodes_control_plane/nodes_workersshare aniporhostname. An identical entry under both lists is allowed: that node is a control plane and a worker. - Control-plane API server (port 6443) reachability —
scale.yml'skubeadm joinneeds this; failing here is faster and clearer than a join timeout deep inside the Kubespray run. - Internet/proxy reachability (same check a fresh
installruns against every node) — a warning only, since a private registry mirror can make it a non-issue.
Not checked, and each would currently only surface as a Kubespray failure partway through scale.yml rather than a fast, clear pre-check:
- Calico's data path (BGP/VXLAN) between the new node and the rest of the cluster. Before the node joins,
calico-nodeisn't running there. After the join,add-nodewaits for the node's DaemonSet pods to be Ready and keeps the pending taint if they are not, but it does not test traffic between pods on different nodes. A large node can need more than Kubespray's defaultcalico_node_memory_limit(500M): calico-node is then OOM-killed and the node stays tainted. Set a higher limit inenv/<name>/kubespray_extra.yml. - The checks on the new node itself under
--dry-run. The dry run only checks SSH: "already joined to a cluster", Docker, API server and internet reachability are checked by the real run, beforescale.yml. - Whether the node has adequate resources (CPU/memory/disk) for what's expected to run there — the mechanics are easy (Ansible already gathers these facts), but there's no minimum threshold defined anywhere in this codebase to check against yet.
- Explicit target required —
-e node=<name>must be set and non-empty; the play asserts this and fails with "No nodes specified for removal" otherwise. - Interactive confirmation by default — prompts "Type 'yes' to delete nodes" unless
-e skip_confirmation=trueis passed. - Graceful drain before removal — cordons and evicts workloads from the node before touching it (seen in our test log:
TASK [remove_node/pre_remove : Remove-node | Drain node except daemonsets resource]). - OS reset by default (
reset_nodes=true) — stops kubelet and containerd and removes/etc/kubernetesand the CNI state. It does not leave the node fully clean:cali-*/KUBE-*iptables chains and their ipsets remain, and containerd is stopped with its binary gone. Re-adding the machine as it is works; flush the chains before reusing it for anything else. The reset can be skipped (reset_nodes=false) for an unreachable node, but only paired with an explicitallow_ungraceful_removal=true— a second, deliberate opt-out. - Inventory is untouched by the play itself — the node stays listed during/after the run; removing the entry is left to the caller, as a deliberate checkpoint.
--dry-runprints the computed node diff and the exact Kubespray invocation, and changes nothing.- A
confirm()gate (y/N or--force) — separate from Kubespray's ownskip_confirmation, which we pass through specifically so Kubespray's prompt doesn't block a non-interactive run; ours is the one that actually gates the destructive action. - No diff, no action — if
nodes.yamlalready matches the live cluster, both actions report "nothing to do" and exit, never invoking Kubespray. Aremove-nodewhose post phase failed (the node is gone from the cluster and fromnodes.yaml, but still in the inventory) runs the post phase again instead. nodes.yaml, the inventory and the cluster must agree.add-noderefuses while a joined node is missing fromnodes.yaml(its prep pass would drop that node from the inventory).remove-noderefuses a node that is no longer in the inventory (Kubespray could not reach it), and anodes.yamlthat also lists nodes not yet joined (its post pass would put them in the inventory and the NFS exports).- Health after
remove-nodeis judged against the findings from before the removal: only new problems fail the command, and pods the drain evicted get a minute to be scheduled. - Fails closed when the cluster can't be read. If
kubectlcan't list the cluster's nodes or namespaces, both actions stop with the error rather than diffingnodes.yamlagainst an empty list.remove-nodedoes the same for PodDisruptionBudgets and the preflight simulation: a check that didn't run refuses the removal, it never passes it. - ERAG guard — both actions refuse when ERAG is deployed (see What's not supported).
- Control-plane removal is refused — see Control-plane nodes are not removed.
- Inventory regeneration is deliberately deferred until after
remove-node.ymlsucceeds, so Kubespray always gets a node it can still reach. - Workload visibility before you confirm — lists real (non-DaemonSet, non-static-pod) workloads running on the node(s) about to be removed, so a model or service that's only running there doesn't get evicted as a surprise.
- PodDisruptionBudget guard — refuses the removal if any pod on the node is currently covered by a PDB with
disruptionsAllowed: 0; eviction would be rejected by the API server no matter how many timesremove-node.ymlretries. - Preflight simulation (capacity / spread / local-data / last-capable-node) — see below.
- Last-worker warning — flags when the removal would leave zero worker nodes, and separately reports whether the control-plane node currently has the
NoScheduletaint (so you know whether that actually means "nothing schedulable anywhere" or just "back to single-node"). A warning, not a block — dropping to zero workers is a valid, already-supported topology when it's intentional. (A control-plane node without the taint is also a valid remaining placement target for the preflight simulation above — it isn't excluded just for being control-plane, only for taints the evicted pods don't tolerate.) - Balloon policy cleanup — if CPU pinning (
nri_cpu_balloons) is installed,remove-nodedeletes the removed node'snode.<NAME>BalloonsPolicy once the node is gone, so a node later added under the same name starts from its own freshly generated policy instead of inheriting one written for the old hardware. (add-nodeapplies the new node's per-node policy itself — see step 4 of Adding worker nodes.) - Post-remove health verdict — once the node is gone, runs the same checks as
status --health(node Readiness, no crash-looping/image-pull-failing/unschedulable pods) and fails theremove-nodecommand on a problem that was not there before the removal. Advisory at that point, not a rollback: the node has already been reset and dropped from the cluster, so recovering meansadd-node, not an automatic revert.
Before confirm(), roles/kubernetes/files/simulate_node_removal.py simulates where every evicted pod on the node(s) being removed would have to land, and refuses outright — no flag skips this — when:
| Check | Refused when | Example |
|---|---|---|
| Capacity | the remaining nodes able to take these pods have too little free allocatable CPU/memory/GPU/hugepages for what they request | A model fills the only two workers; removing one leaves the other short on CPU for everything that would land there |
| Spread | a required pod anti-affinity or topologySpreadConstraint (whenUnsatisfiable: DoNotSchedule) can't be satisfied on the remaining nodes |
Two replicas required on different hosts, only one host left |
| Local data | the pod uses a volume bound to that specific node (PV local/node-affinity, or a known local-path provisioner) |
A local-path or similar node-pinned PVC — the data does not move with the pod |
| Last capable node | the pod's nodeSelector/required nodeAffinity/taints, or an extended resource it requests (e.g. a GPU), isn't satisfiable by any remaining node |
The only GPU-labeled node while a GPU workload is running there |
This is a heuristic, not a scheduler simulation — it models the common cases above closely enough to catch them, not every possible scheduling predicate. Capacity is checked pod by pod: each evicted pod is placed on one specific remaining node it is allowed to run on, and that node's free capacity is reduced before the next pod is placed. The hardest pods to place go first (fewest eligible nodes, then largest request), and each goes on the eligible node it fills most tightly. So a pod whose only eligible node is full is refused even when other nodes have room it could never use. --dry-run prints the resulting plan: the target node for every pod it placed. It is a greedy placement, not an exact solver, so it can occasionally refuse a removal that a different placement order would have fit. A false refusal costs a retry; a false pass costs an outage.
For the same reason, if the simulation can't run at all (an API error, or the script itself failing), remove-node refuses with the error instead of treating it as "nothing found".
Neither action rolls back. What was done stays done; re-running is the recovery path. If remove-node fails, re-run remove-node before any other action.
| Fails during | State | Recovery |
|---|---|---|
add-node pre-flight |
Nothing installed on the node | Fix the cause, re-run add-node |
add-node scale.yml, before the join |
Packages/containerd/kubelet partly installed; the node is not in kubectl get nodes |
Re-run add-node (scale.yml is safe to repeat) |
add-node scale.yml, after the join wrote /etc/kubernetes/kubelet.conf but before the node registered |
The node is not in kubectl get nodes, and a re-run refuses it as already joined |
Run kubeadm reset -f on the node, then re-run add-node |
add-node post phase |
Node joined, still tainted add-node-pending — nothing schedules there |
Re-run add-node; it runs scale.yml again for the tainted node, then the post phase |
remove-node checks |
Nothing changed | Fix the cause, re-run |
remove-node drain |
Node left cordoned | Re-run remove-node, or kubectl uncordon <node> to keep it |
remove-node reset / post phase |
Node partly reset, or removed but still in the inventory | Re-run remove-node (--node-lost if unreachable) |
Errors marked ...ignoring in Kubespray's reset output are expected — for example crictl failing to stop pods once the node can no longer reach the API server, or /run/calico not being deletable because it holds a cgroup mount. They don't fail the run.
| If you want to… | Go to |
|---|---|
| Deploy across multiple nodes in the first place | Multi-Node & BYO Cluster |
Understand the workload-class labels re-applied to new nodes |
Node Topology & Workload Placement |
Look up every global_config.yaml / nodes.yaml field |
Configuration Reference |
- Kubespray — Adding/replacing a node — upstream docs for
scale.ymlandremove-node.yml, including the first-control-plane-node limitation this doc summarizes