Node Scaling — add-node / remove-node
Grow or shrink an already-provisioned cluster without a full teardown/reinstall, using Kubespray's own scale.yml and remove-node.yml playbooks.
Note: ADVANCED OPERATION: PROCEED ONLY IF YOU KNOW WHAT YOU'RE DOING — always run with
--dry-runfirst.
Overview
Two CLI actions, both driven entirely from env/<name>/nodes.yaml (on a rack-scale env, rack-profile.yaml: see Rack-scale) — neither takes a node name on the command line:
| Action | Kubespray playbook | Scope |
|---|---|---|
add-node | scale.yml | Worker nodes only |
remove-node | remove-node.yml | Worker nodes only |
The workflow is always: edit nodes.yaml, then run the action. The installer regenerates the inventory from the edited file and diffs it against the live cluster (kubectl get nodes) to figure out which host(s) changed — there is nothing else to specify.
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.
./es_auto_installer.sh add-node --dry-run # preview after editing nodes.yaml
./es_auto_installer.sh add-node # scale in the new worker(s)
./es_auto_installer.sh remove-node --dry-run # preview after deleting entries
./es_auto_installer.sh remove-node # remove the dropped node(s)
Before you start
add-node and remove-node run against the live cluster from the installer host, so it must reach the API server at https://<control-plane-ip>:6443, not only the nodes over SSH. Without that access, both stop before Kubespray runs.
What's 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 |
What's not supported
| 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 |
| 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 |
Adding worker nodes
Append entries to
nodes_workersinenv/<name>/nodes.yaml:yamlnodes_workers: - ip: 10.0.0.22 hostname: worker3Preview, then apply:
bash./es_auto_installer.sh add-node --dry-run --env <name> ./es_auto_installer.sh add-node --env <name>What
add-nodedoes:- Regenerates the inventory and diffs
nodes.yamlagainst the live cluster to find the new node(s). - Runs a pre-flight on them: SSH, not already joined, API server and internet reachability (see Safety).
- Computes their kubelet CPU reservation, then runs Kubespray
scale.ymlfor just the new node(s). - Applies the
workload-classlabel (and NFS export, on NFS storage), waits forReadyand for the node's DaemonSet pods (calico-node, kube-proxy, ...), and — ifnri_cpu_balloonsis installed — creates each node's ownnode.BalloonsPolicy. Existing nodes and running models are not touched.
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.- Regenerates the inventory and diffs
Control-plane nodes are not supported by add-node
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.
After adding a node
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). model-manager deploy --node <name>is a preference, not a requirement — if the node doesn't qualify, the pod lands elsewhere. Check where it went withkubectl get pods -n llm-inference -o wide.
Rack-scale
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 silicon/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.
Removing nodes
Delete the entry from
nodes_workersinenv/<name>/nodes.yaml.Preview, then apply:
bash./es_auto_installer.sh remove-node --dry-run --env <name> ./es_auto_installer.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 before the installer deletes its stale per-nodehost_varsfile.textremove-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.
Control-plane nodes are not removed
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.
A node that is already gone (--node-lost)
For a node that is unreachable or NotReady, use:
./es_auto_installer.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.
Safety
Built into Kubespray's scale.yml
- 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.
Built into add-node's pre-flight
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.
Known gaps in add-node's pre-checks
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.
Built into Kubespray's remove-node.yml
- 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.
Built into es_auto_installer.sh
--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.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 3 above.) - 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.
Preflight simulation (capacity / spread / local-data / last-capable-node)
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".
If an action fails
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.
Related Docs
| 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 |
External References
- Kubespray — Adding/replacing a node — upstream docs for
scale.ymlandremove-node.yml, including the first-control-plane-node limitation this doc summarizes