Kubespray: a Dedicated Control Plane and Two Workers for an Overloaded Node

Published: 2026-06-23

A single-node test cluster is fine until one machine has to do everything: the control plane, etcd and a heavy database like ClickHouse. Then the node runs out of CPU. It looks like slow storage, but the real cause is usually CPU contention. The fix is not a faster disk. The fix is to split the roles across VMs: a dedicated control plane that nothing else competes with, plus workers sized for the workload. In this post I build this layout with Kubespray on Ubuntu 24.04: one control-plane + etcd node and two workers, with Cilium replacing kube-proxy. And, just as important, I show how to make the load really spread once the nodes exist.


Diagnose first: is it really the disk?

Before you add hardware, find out what is really overloaded. On a node where the disks "feel slow", check whether tasks wait for I/O or for CPU. You don't need to install anything:

bashnproc                                       # how many cores you actually have
cat /proc/loadavg                           # load vs cores
cat /proc/pressure/cpu /proc/pressure/io    # PSI: % of time stalled, last 10/60/300s
vmstat 1 3                                  # 'wa' = iowait%, 'b' = procs blocked on I/O

If wa is low (single digits), b is ~0, PSI io is low, PSI cpu is high and the load is higher than your core count, then the disk is fine and the CPU is the bottleneck. What feels like disk lag is everything waiting in line for busy cores: etcd's fsync, the kubelet and the API server all wait for CPU. Faster storage changes nothing here. (If wa is high and processes sit in the D state, then it really is storage. That is a different problem.)

The cure for CPU saturation is more cores and fewer things fighting over them. This is exactly what a dedicated control plane plus workers gives you.

The layout: one control plane, two workers

cp1       10.0.0.10   control-plane + etcd   (dedicated, tainted)
worker1   10.0.0.11   heavy workload (the DB)
worker2   10.0.0.12   everything else

Three roles that fought each other on one node now have room:

  • cp1 runs only the control plane and the single etcd member. It stays tainted, so etcd's fsync and the API server no longer compete with applications for CPU. This node can be small (a control plane for a small cluster needs ~2-4 cores). Give it a fast disk for /var/lib/etcd, ideally a separate one.
  • worker1 / worker2 run the workloads. Two workers give you twice the schedulable CPU and a way to keep the heaviest workload away from everything else.

I don't use three control-plane nodes here, and this is on purpose. Three nodes would give etcd HA (a quorum of 3 survives one failure), but they put the control-plane overhead back on every node. That is the opposite of isolation. On a test stand the goal is to remove load, not HA. One etcd member is fine. Later you can grow into a real 3-node HA control plane with an inventory edit (see the last section).

The trap: more nodes don't spread the load by themselves

New workers do nothing on their own. The scheduler places pods based on their resource requests. A pod without requests can land anywhere, and several such pods can end up on the same worker. Worse, one large pod does not split: one ClickHouse pod uses the cores of one node, no matter how many workers you have. The load spreads only if you:

  1. Give every heavy pod real requests/limits, so the scheduler can place them and limit them.
  2. Keep the main workload on its own node, so it does not share cores with the rest.

I show both steps after the install. If you skip them, you just move the overload to one of the workers.

The control machine

Kubespray runs from a control machine (your laptop or a small admin VM) and connects to the nodes over SSH. This machine does not have to be one of the nodes. The usual problem here is the Ansible version. Kubespray needs one specific ansible-core version, and a newer one from your distro fails with confusing errors. Use the pinned versions in a venv.

bash# Pin to a release tag — never build a stand off main
git clone -b v2.31.0 https://github.com/kubernetes-sigs/kubespray.git
cd kubespray

python3 -m venv .venv && source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt   # pins ansible==11.13.0 → ansible-core 2.18.x

v2.31.0 (April 2026) supports Kubernetes up to 1.35.4, Cilium 1.19.3 and Ubuntu 24.04 (with cgroup v2, which current Kubespray expects). requirements.txt pins ansible==11.13.0, which means ansible-core 2.18.x. The role metadata says requires_ansible: ">=2.18.0,<2.19.0". Do not run apt install ansible: it gives you 2.19+, and the syntax check fails before anything is deployed.

You also need SSH key access to all three nodes and a login with sudo. If the login is in the sudo group but without NOPASSWD, pass -K and type the sudo password once (see below).

Inventory

Copy the sample and edit it. The sample has hundreds of good defaults that you want to keep.

bashcp -rfp inventory/sample inventory/mycluster

inventory/mycluster/inventory.ini for the one-control-plane, two-worker layout:

ini[kube_control_plane]
cp1 ansible_host=10.0.0.10 ip=10.0.0.10 ansible_user=ubuntu etcd_member_name=etcd1

[etcd:children]
kube_control_plane

[kube_node]
worker1 ansible_host=10.0.0.11 ip=10.0.0.11 ansible_user=ubuntu
worker2 ansible_host=10.0.0.12 ip=10.0.0.12 ansible_user=ubuntu

What the fields mean:

  • ansible_host= is the address that Ansible connects to over SSH.
  • ip= is the address that kubelet and etcd bind to. Set it explicitly. On a VM with several NICs, the detected IP is often the wrong one (the CNI or a bridge interface).
  • ansible_user= is the SSH login. You can also set it for all hosts with --user.
  • [etcd:children] kube_control_plane puts etcd on the control-plane node(s). [kube_control_plane] has exactly one host, so etcd gets exactly one member. That is an odd number, as etcd requires.

The main difference from a "use every node" layout: cp1 is not in [kube_node]. This keeps it a dedicated control plane. It joins as a control-plane node (kubelet runs, but the node has the NoSchedule taint), and the scheduler never puts your workloads on it.

Cluster configuration

All the decisions live in three files under inventory/mycluster/group_vars/.

k8s_cluster/k8s-cluster.yml

yaml# Pin the version explicitly. Kubespray computes a default dynamically,
# so leaving it unset means a minor bump can change under you on the next run.
kube_version: v1.35.4

# The sample default is calico — switch to cilium to match the rest of the fleet
kube_network_plugin: cilium

container_manager: containerd

# Pull the admin kubeconfig (and a matching kubectl) back to the control machine
kubeconfig_localhost: true
kubectl_localhost: true

# Add any address you'll reach the API through to the apiserver cert SANs
supplementary_addresses_in_ssl_keys:
  - 10.0.0.10

kube_proxy_mode is in this file too, but it does not matter once Cilium replaces kube-proxy (next section). Kubespray then does not install kube-proxy at all.

k8s_cluster/addons.yml

yamlhelm_enabled: true                   # default false; handy on a stand where you'll helm install things
local_path_provisioner_enabled: true # Kubespray ships NO StorageClass by default — see Storage below

k8s_cluster/k8s-net-cilium.yml

yamlcilium_version: "1.19.3"

# Cilium handles service load-balancing in eBPF; kube-proxy is not installed at all
cilium_kube_proxy_replacement: true

# On-prem L2 LoadBalancer (optional — leave false until you need LB IPs)
cilium_l2announcements: false
cilium_loadbalancer_ip_pools: []

How kube-proxy actually gets removed

When kube_network_plugin: cilium is set and cilium_kube_proxy_replacement is true, Kubespray adds addon/kube-proxy to the kubeadm init phases it skips. kube-proxy is never created. You need both conditions. If you set only the CNI, you still get kube-proxy. If you set only the Cilium flag without choosing Cilium, it does nothing. In v2.31.0 the value must be the boolean true (old Cilium strings like "strict" are deprecated upstream in 1.19). You don't need kube_proxy_remove: true as well. It is a general fallback for other CNIs and is not needed here.

Running the install

bashansible-playbook -i inventory/mycluster/inventory.ini \
  --become --become-user=root \
  --ask-become-pass \
  cluster.yml

--become switches to root on the hosts. --ask-become-pass (-K) asks for the sudo password once. You need it when the login has sudo but not NOPASSWD. If SSH also uses a password instead of a key, add -k too.

cluster.yml is the full build. It prepares the OS (turns off swap, loads br_netfilter/overlay, sets sysctls), installs containerd, runs kubeadm init on cp1, joins both workers, sets up etcd and installs Cilium. On three VMs it takes about 20-30 minutes. The run is idempotent: a second run brings the cluster to the same state and does not rebuild it. So after a failed run, you can usually fix the cause and just start it again.

Kubespray takes care of swap, sysctls, kernel modules, containerd, kubeadm, etcd, PKI and Cilium. You take care of: python3 on each node, SSH key and sudo access, the firewall (Kubespray does not manage it: run sudo ufw disable on a test stand or open the k8s/etcd/Cilium ports), time sync (chrony, because etcd does not like clock skew), access to image registries and unique hostnames.

Keep the control plane dedicated and isolate the heavy workload

This step is what actually takes the load off with three VMs.

Don't remove the taint from cp1. By default, Kubespray puts the node-role.kubernetes.io/control-plane:NoSchedule taint on control-plane nodes, and here that is exactly what you want. (On a 2-VM stand you would remove it to use the node for workloads. Here the whole point is to keep workloads off the control plane.) Check that the taint is still there:

bashkubectl get node cp1 -o jsonpath='{.spec.taints}'
# [{"effect":"NoSchedule","key":"node-role.kubernetes.io/control-plane"}]

Pin the heavy workload to one worker. Put a taint on worker1 so that only the database tolerates it, then send the database there:

bashkubectl taint nodes worker1 dedicated=db:NoSchedule
yaml# in the DB's pod spec
spec:
  nodeSelector:
    kubernetes.io/hostname: worker1
  tolerations:
    - key: dedicated
      value: db
      effect: NoSchedule
  containers:
    - name: clickhouse
      resources:
        requests: { cpu: "6", memory: 24Gi }   # without requests the scheduler can't reason about capacity
        limits:   { cpu: "10", memory: 32Gi }   # without limits it's a noisy neighbour

Everything else now goes to worker2 (and never to the control plane). For workloads with several replicas, spread them with anti-affinity instead of pinning:

yamlaffinity:
  podAntiAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchLabels: { app: my-api }
          topologyKey: kubernetes.io/hostname

Also give the rest of your noisy pods (log shippers, sidecars) explicit CPU requests. Pods without requests are the usual reason why one node slowly and quietly fills up.

Storage on a multi-node cluster

With several nodes, storage behaves differently. By default, Kubespray installs no StorageClass (unlike k3s), so kubectl get sc is empty until you choose one. Here are the options and what happens with each when a pod moves to another node:

Provisioner Pod moves to another node CPU cost Use when
local-path (built-in addon) PV is pinned to the node, so the pod stays on its node ~none test data you can lose; node affinity is OK
NFS subdir data follows the pod (network volume) low shared files / RWX; the NFS server node is a single point of failure
Longhorn (Helm, not a Kubespray addon) a replica is already on the target node, so data follows high (an engine + replica for each volume, iSCSI) data must survive the loss of a node

On a stand with little CPU, the choice is easy: local-path (the cheapest) or NFS (light, RWX) instead of Longhorn. Longhorn's synchronous replication and an engine for each volume use exactly the CPU you are trying to free up. local_path_provisioner_enabled: true (set above) creates a default StorageClass named local-path. Its PVs are pinned to a node, so a pinned DB pod and its data stay together on worker1 anyway.

Getting the kubeconfig

With kubeconfig_localhost: true, the admin config is copied to the control machine:

bashexport KUBECONFIG=$PWD/inventory/mycluster/artifacts/admin.conf
kubectl get nodes -o wide
# NAME      STATUS   ROLES           AGE   VERSION    INTERNAL-IP
# cp1       Ready    control-plane   9m    v1.35.4    10.0.0.10
# worker1   Ready    <none>          7m    v1.35.4    10.0.0.11
# worker2   Ready    <none>          7m    v1.35.4    10.0.0.12

The server: line in admin.conf points to the IP of cp1. If you connect to the cluster through a different address (NAT, a hostname, a jump host), change server: to this address. Also make sure it was in supplementary_addresses_in_ssl_keys. Otherwise the API server certificate has no SAN for it, and TLS refuses the connection.

Day 2: add workers, grow into HA

The same inventory is used by the lifecycle playbooks:

bash# Add worker3: append it to [kube_node], then
ansible-playbook -i inventory/mycluster/inventory.ini --become -K scale.yml

# Cleanly drain and remove a node
ansible-playbook -i inventory/mycluster/inventory.ini --become -K \
  -e node=worker2 remove-node.yml

# Rolling, one-node-at-a-time version upgrade (bump kube_version first)
ansible-playbook -i inventory/mycluster/inventory.ini --become -K upgrade-cluster.yml

# Wipe k8s/etcd/CNI off every host, back to bare OS — destructive
ansible-playbook -i inventory/mycluster/inventory.ini --become -K reset.yml

When one control plane is no longer enough, grow into HA. Add two more hosts to [kube_control_plane], so etcd has three members (the smallest number that survives a failure). Then run upgrade-cluster.yml to expand etcd and the control plane. To add worker capacity, add the host and run scale.yml. The inventory is the cluster, and you never need to rebuild it.

What can go wrong

I added a worker, but nothing moved to it

Pods without resource requests are not rebalanced, and existing pods don't move by themselves. Set requests on the heavy pods, place them with anti-affinity or a node taint, then delete or redeploy them so the scheduler places them again. One large pod will still use one node. You cannot split it.

I removed the control-plane taint by mistake

Old habit from one- and two-node clusters. If you ran kubectl taint nodes cp1 ...-, put the taint back so workloads leave the control plane:

bashkubectl taint nodes cp1 node-role.kubernetes.io/control-plane=:NoSchedule

"ansible-core version is not supported"

You ran Ansible outside the venv (or installed it with apt install ansible, which gives 2.19+). Create the venv again and run pip install -r requirements.txt. The pinned ansible==11.13.0 is ansible-core 2.18.x, the only supported version line for v2.31.0.

Gathering facts fails: /usr/bin/python3 not found

This is a minimal or cloud Ubuntu image without Python. Kubespray needs python3 on every node before it can do anything: ssh ubuntu@10.0.0.12 sudo apt-get install -y python3.

Missing sudo password

The login has sudo but not NOPASSWD. Add -K (--ask-become-pass). If SSH also uses a password, add -k.

etcd does not become healthy / the install hangs at the etcd join

Almost always this is clock skew or an even number of etcd members. Keep exactly one host in [etcd] here, and make sure chrony runs on all nodes. etcd rejects peers with different clocks.

Pods are stuck in Pending, or kube-proxy is still there

bashsudo ufw status        # should be inactive on a test stand — it blocks CNI/etcd otherwise
kubectl -n kube-system get pods | grep kube-proxy   # should be empty with Cilium replacement
grep -r cilium_kube_proxy_replacement inventory/mycluster/group_vars/   # must be true
grep -r kube_network_plugin            inventory/mycluster/group_vars/   # must be cilium
kubectl -n kube-system get pods -l k8s-app=cilium -o wide

Summary

  • The symptom was "slow disks", the cause was CPU contention. Check wa/PSI before you buy storage. On an overloaded single node everything, etcd included, feels like disk lag.
  • Split the roles across VMs: a dedicated, tainted control plane + two workers. etcd and the API server stop competing with applications for CPU, and two workers double the schedulable capacity.
  • New nodes alone don't spread the load. Set requests/limits, pin the main workload to its own worker and use anti-affinity for apps with replicas. One large pod cannot be split.
  • Cilium with cilium_kube_proxy_replacement: true removes kube-proxy completely, but only when kube_network_plugin: cilium is set too.
  • Choose storage by CPU budget: on a stand with little CPU, use local-path or NFS instead of Longhorn. Kubespray installs no StorageClass by default.
  • The inventory is the cluster. Add workers with scale.yml. Later you can grow to a 3-node HA control plane by moving hosts into [kube_control_plane]. It is an edit, not a rebuild.