← cd ../blog
-> -> -> (HEAD → main, origin/main)
Author: Damian Van Der Merwe <me@damianvandermerwe.com>
Date:   2026-04-23

Building a Production-Ready RKE2 Cluster with kube-vip HA

An end-to-end walkthrough of provisioning nodes and bootstrapping a highly available RKE2 Kubernetes cluster — with kube-vip for control-plane failover, tuned kernel parameters, and optional LINSTOR block storage.

[kubernetes][rke2][kube-vip][infrastructure][linstor][rocky-linux]

This post walks through building a highly available RKE2 Kubernetes cluster on bare-metal or virtualised Linux nodes, using kube-vip to float a virtual IP across the control plane so losing a node doesn’t take the API server with it. It covers everything from node sizing and kernel tuning through to bootstrapping the first server, joining additional nodes, and optionally wiring up LINSTOR for replicated block storage. The specifics here are based on a Rocky Linux 10 build, but nearly all of it translates cleanly to other EL-family distros and to vanilla k3s with minor tweaks.

The goal is a cluster you can actually run workloads on — not just a demo lab — so this guide leans into the bits that quietly bite you in production: the sysctl values that make Elasticsearch happy, the NetworkManager policy that stops your CNI from collapsing, and the CIS hardening step that locks down etcd without locking you out of your own cluster.

Why RKE2 Instead of Vanilla Kubernetes

RKE2 (Rancher Kubernetes Engine 2) is Rancher’s hardened distribution of upstream Kubernetes. It’s designed for regulated environments: it’s FIPS 140-2 compliant, ships with a CIS Benchmark profile out of the box, and has a security posture that’s far saner than a hand-rolled kubeadm install.

What you get on top of upstream:

  • A single binary installer that handles the control plane, kubelet, containerd, and CNI
  • systemd-managed services for rke2-server and rke2-agent
  • Sensible defaults for air-gapped and government deployments
  • First-class support for the CIS Kubernetes Benchmark via a single config flag

What you give up: a little bit of flexibility around the kubelet flags, and you need to learn a slightly different lifecycle (systemctl restart rke2-server rather than cycling static pods). In exchange you get an install that’s boring in the best sense of the word.

Cluster Planning: Node Sizing and Layout

A production-worthy control plane needs three nodes. This isn’t an RKE2 thing — it’s an etcd thing. etcd runs Raft consensus, so you need a quorum (majority) to make progress, which means 2n+1 nodes. Three tolerates one failure. Five tolerates two.

Hardware Baseline Per Node

ResourceMinimumNotes
Primary disk100 GB (OS)Holds the OS, container images, and /var/lib/rancher
CPU cores2More if you run the API server hot — 4+ for real workloads
RAM6 GB8–16 GB is more comfortable once workloads land
Secondary disk500 GB SSDOptional — only needed if you’re running LINSTOR for PV storage
ARP spoofingPermitted on the hypervisorRequired for kube-vip’s ARP-based VIP floating to work
ARP spoofing on virtualised nodes
If you're running nodes on a hypervisor that filters MAC spoofing or ARP by default (Hyper-V, vSphere, OpenStack Neutron), you must permit it on the NICs your control-plane nodes use. kube-vip in ARP mode (the default) broadcasts gratuitous ARPs to move the VIP between nodes, and the hypervisor will happily drop those packets and leave you wondering why failover doesn't work.

Network Planning

Pick three things before you start:

  1. A static IP range for your nodes, all on the same L2 segment for simplicity
  2. A virtual IP (VIP) for the control plane — unused, same subnet as the nodes. This is the address kubectl will talk to
  3. A DNS name pointing at the VIP (e.g. rke2.internal.example.com) — essential for TLS, since you can’t put an IP in SANs cleanly and rotate nodes without rebuilding

Phase 1 — OS Installation and Baseline

The rest of this guide assumes Rocky Linux 10 on each node, but any modern EL-compatible distro works. During the installer:

  1. Enable SSH during install so you can finish configuration remotely
  2. Create a non-root user with sudo — don’t SSH as root in production
  3. Assign a static IP and gateway — DHCP works but cluster nodes are stateful enough that static is kinder to your future self
  4. Set a consistent hostname pattern — I use rke2-<os>-<last-ip-octet> (e.g. rke2-el10-21) so kubectl get nodes is self-documenting

After the install completes, SSH in and patch up:

dnf upgrade -y
dnf install -y kernel-devel kernel-headers gcc make

The kernel-devel/gcc packages aren’t for RKE2 itself — they’re prerequisites for DRBD kernel modules if you’re going to run LINSTOR later. If you’re not, you can skip them.

Reboot after the upgrade to pick up any new kernel, then continue.

Optional: LVM Thin Pool for LINSTOR

If you provisioned a secondary SSD for replicated storage, carve it up as an LVM thin pool now. Find the disk with lsblk, then:

pvcreate /dev/sdX
vgcreate linstor_vg /dev/sdX
lvcreate -L 490G --thinpool linstor_thinpool linstor_vg

Thin provisioning lets LINSTOR allocate volumes without pre-reserving space — essential for any kind of snapshot or clone workflow. Leave a few GB of headroom on the disk; a completely full thin pool is the kind of outage you only learn from once.

Phase 2 — Kernel and Host Configuration

This is where most half-finished RKE2 guides fall short. The defaults on a stock Linux install are tuned for a general-purpose server, not a node that runs 100+ containers, a CNI overlay, and an API server all at once.

Sysctl Tuning

Drop the following into /etc/sysctl.d/90-rke2.conf. Each block is annotated with what it actually does:

# Forwarding: required for container-to-container routing through the host
net.ipv4.conf.all.forwarding=1

# --- Memory ---
vm.swappiness=0                          # Minimise swap usage; kubelet hates swap
vm.max_map_count=262144                  # Required by Elasticsearch/JVM workloads

# --- Network: Connection handling ---
net.ipv4.ip_local_port_range=1024 65000  # Wider ephemeral port range for many concurrent conns
net.core.somaxconn=4096                  # Larger listen backlog for busy services
net.core.netdev_max_backlog=4096         # NIC backlog queue depth

# --- Network: Socket buffers ---
net.core.rmem_max=16777216               # 16 MB max receive buffer
net.core.wmem_max=16777216               # 16 MB max send buffer

# --- Network: TCP tuning ---
net.ipv4.tcp_max_syn_backlog=20480
net.ipv4.tcp_max_tw_buckets=400000
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_fin_timeout=15
net.ipv4.tcp_no_metrics_save=1
net.ipv4.tcp_rmem = 131072 1048576 16777216
net.ipv4.tcp_wmem = 131072 1048576 16777216
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_synack_retries=2
net.ipv4.tcp_keepalive_time=600

# --- ARP cache (large clusters) ---
net.ipv4.neigh.default.gc_thresh1=8096
net.ipv4.neigh.default.gc_thresh2=12288
net.ipv4.neigh.default.gc_thresh3=16384

# --- File system watches (for monitoring/GitOps tools) ---
fs.inotify.max_user_instances=8192
fs.inotify.max_user_watches=1048576

A few of these deserve a closer look:

  • vm.max_map_count=262144 — anything JVM-based (Elasticsearch, OpenSearch, Kafka) refuses to start without this. It’s the single most common “the pod is crashlooping with exit code 78” cause on fresh clusters.
  • fs.inotify.max_user_watches — GitOps tools (ArgoCD, Flux), log tailers, and anything that watches file trees will burn through the default 8192 watches on a busy node. 1M is aggressive but memory is cheap.
  • ARP cache gc_thresh* — once you have more than a few dozen pods per node, the default ARP cache overflows constantly and you get mysterious intermittent connectivity issues. These values raise the GC thresholds so the cache can grow to hold every pod’s neighbour entry.

Disable firewalld

systemctl disable --now firewalld

This is contentious, so: why disable the host firewall? Kubernetes network policies and your CNI (Canal/Cilium/Calico) already enforce east-west traffic rules with far more granularity than firewalld can. Leaving firewalld running creates two layers of rules that drift out of sync, and the symptoms — packets silently dropped between pods on the same node — are infuriating to debug.

If you need perimeter rules, enforce them at your upstream firewall or use Cilium network policies. If your security posture mandates a host firewall, use nftables with explicit Kubernetes rules documented, not a distro default that fights your CNI.

Patch NetworkManager to Leave CNI Interfaces Alone

NetworkManager will, by default, try to manage the virtual interfaces your CNI creates — cali*, flannel*, vxlan.calico, and so on. When it does, it’ll helpfully rewrite routes, trigger interface restarts, and generally cause your pod networking to flap.

Create /etc/NetworkManager/conf.d/rke2-canal.conf:

[keyfile]
unmanaged-devices=interface-name:flannel*;interface-name:cali*;interface-name:tunl*;interface-name:vxlan.calico;interface-name:vxlan-v6.calico;interface-name:wireguard.cali;interface-name:wg-v6.cali

This tells NetworkManager to keep its hands off every interface name the Canal CNI (RKE2’s default) produces. If you’re using a different CNI, check its interface naming and extend this list.

SELinux Adjustments

SELinux can break things unexpectedly
RKE2 is fully SELinux-aware as of v1.24+. However, other software you install on your cluster might not be. This will often lead to very strange issues that are incredibly hard to debug. If you dont need selinux, I would recommend disabling it

To disable SELinux entirely:

sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

Otherwise, If you plan to mount SMB shares inside containers:

setsebool -P virt_use_samba on

Reboot

Reboot every node now so all sysctls, kernel updates, and NetworkManager changes apply cleanly.

Phase 3 — Installing RKE2

The RKE2 installer is super simple to use, smooth sailing for this section

Run the Installer on Every Node

curl -sfL https://get.rke2.io | sh -

This drops the rke2 binary, containerd, the CNI plugins, and the systemd units under /etc/systemd/system/. Nothing starts yet — that’s by design.

Configure the First Control-Plane Node

Create /etc/rancher/rke2/config.yaml on the first node (no server: or token: — it’s the bootstrap node):

tls-san:
  - rke2.internal.example.com     # DNS name pointing at the VIP
  - 10.0.0.20                      # The VIP itself
kube-apiserver-arg:
  - "default-not-ready-toleration-seconds=30"
  - "default-unreachable-toleration-seconds=30"
disable: rke2-ingress-nginx

What each setting does:

  • tls-san — extra SANs baked into the API server certificate. Without these, kubectl against the VIP will fail TLS verification. List both the DNS name and the raw IP, because some clients skip DNS and others don’t.
  • default-*-toleration-seconds=30 — how long to tolerate a node being NotReady or unreachable before evicting pods. The default is five minutes, which is fine for stable clusters but painful when you’re actively testing failover. 30 seconds is more responsive without being trigger-happy.
  • disable: rke2-ingress-nginx — the bundled ingress controller is fine for a quick lab, but in production you almost certainly want to install your own (Traefik, Istio Gateway, a managed NGINX) with version pinning under your control.
CIS Hardening (optional but recommended)
If you need CIS Benchmark compliance, add profile: "cis" to the config. Before you start RKE2, create the etcd user and drop the CIS sysctl overlay:

sudo useradd -r -c "etcd user" -s /sbin/nologin -M etcd -U
cp -f /usr/share/rke2/rke2-cis-sysctl.conf /etc/sysctl.d/60-rke2-cis.conf
sudo systemctl restart systemd-sysctl

Skipping these two steps and flipping on profile: cis will make rke2-server refuse to start.

Start the First Node

systemctl enable --now rke2-server.service
journalctl -u rke2-server -f

Watch the journal — the first start takes a couple of minutes as it pulls images and brings up the control plane. When you see rke2 v1.x.y+rke2rX is up and running, you’re ready to talk to it.

terminal
$ /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get nodes

Phase 4 — kube-vip for Control-Plane HA

A single node is not an HA control plane. What makes RKE2 HA is a virtual IP that floats between the control-plane nodes, so that when you kubectl against https://rke2.internal.example.com:6443, you’re always hitting whichever node currently holds the VIP.

kube-vip is the cleanest way to do this on bare metal or on hypervisors without a cloud LB. It runs as a static pod on each control-plane node, elects a leader via Kubernetes lease, and the leader ARPs for the VIP so the LAN routes traffic to it. When the leader dies, a new election happens in seconds and the surviving node takes over.

Generate and Apply the kube-vip Manifest

Download the manifest generator (this runs as a one-shot container):

KVVERSION=v0.8.4
alias kube-vip="ctr --namespace k8s.io run --rm --net-host 
  ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip"

kube-vip manifest daemonset 
  --interface eth0 
  --address 10.0.0.20 
  --inCluster 
  --taint 
  --controlplane 
  --services 
  --arp 
  --leaderElection > kube-vip.yaml

Flag breakdown:

  • --interface eth0 — the NIC that carries cluster traffic. Match whatever your nodes actually use (ens192, enp3s0, etc.)
  • --address — the VIP, which must be unused and on the same subnet as the nodes
  • --arp — ARP mode (vs BGP). ARP is the simplest option on flat L2 networks
  • --controlplane — float this VIP for the API server on port 6443
  • --services — also act as a LoadBalancer implementation for type: LoadBalancer services (optional but useful)
  • --leaderElection — use a Kubernetes lease for leader election rather than raft

Now apply it:

/var/lib/rancher/rke2/bin/kubectl 
  --kubeconfig /etc/rancher/rke2/rke2.yaml 
  apply -f kube-vip.yaml -n kube-system

Within a few seconds, one of the control-plane nodes will claim the VIP. Verify with ip addr show eth0 — you’ll see the VIP as a secondary address on the current leader.

Test failover early, not late
Reboot the VIP holder once things look healthy. If failover doesn't work now, it won't work at 3am either — and debugging kube-vip is much easier on a fresh cluster with no workloads than on one running your company's production traffic.

Phase 5 — Joining Additional Nodes

Retrieve the Join Token

On the first node, the token lives at:

/var/lib/rancher/rke2/server/node-token

It’s a single-line file starting with K10.... Copy the whole thing.

Configure Each Additional Server

On every subsequent control-plane node, create /etc/rancher/rke2/config.yaml with the server and token fields populated, pointing at the VIP (not the first node’s IP — always go through the VIP so joining is itself HA-aware):

server: https://rke2.internal.example.com:9345
token: K10abc...   # from node-token on the first server
tls-san:
  - rke2.internal.example.com
  - 10.0.0.20
kube-apiserver-arg:
  - "default-not-ready-toleration-seconds=30"
  - "default-unreachable-toleration-seconds=30"
disable: rke2-ingress-nginx

Note: port 9345 is the RKE2 supervisor (join) port; 6443 is the API server. Get these confused and joining will fail with cryptic TLS errors.

Then start it:

systemctl enable --now rke2-server.service

After a couple of minutes, kubectl get nodes should show all three nodes as Ready. Agent-only nodes (workers without the control plane) follow the same pattern but with rke2-agent instead of rke2-server.

Phase 6 — Optional: LINSTOR for Replicated Block Storage

A Kubernetes cluster without persistent storage isn’t very useful, and on bare metal you don’t get a cloud block store handed to you. LINSTOR (with the Piraeus operator) gives you replicated block volumes backed by DRBD — think of it as a software-defined SAN that replicates writes synchronously across nodes.

Assuming you created the linstor_vg/linstor_thinpool on each node back in Phase 1 and installed the Piraeus operator, you configure the storage pool with:

kubectl apply -f - <<EOF
apiVersion: piraeus.io/v1
kind: LinstorSatelliteConfiguration
metadata:
  name: storage-pool
spec:
  storagePools:
    - name: linstor-thinpool
      lvmThinPool:
        volumeGroup: linstor_vg
        thinPool: linstor_thinpool
EOF

Piraeus discovers the thin pool on every node that matches the satellite selector and advertises it to LINSTOR. From there you create a StorageClass pointing at the pool with a replica count (2 or 3) and a placementPolicy, and dynamic provisioning just works.

Full LINSTOR setup is beyond the scope of this post — see the Piraeus operator docs — but the key things to get right are:

  • Thin pool on fast storage (NVMe/SSD). DRBD synchronous replication is unforgiving of spinning disks.
  • Matching kernel versions across nodes so the DRBD module compiles consistently. This is why the kernel-devel package went in early.
  • A dedicated replication network if you have the NICs — DRBD traffic is chatty under write load.

Sanity Checklist Before Declaring Victory

Before you start shipping workloads, walk through the checklist:

  • kubectl get nodes shows all three control-plane nodes as Ready
  • kubectl get pods -n kube-system shows kube-vip, CoreDNS, Canal, and the RKE2 components all Running
  • The VIP resolves and answers from kubectl on a client machine
  • Reboot the VIP holder → a different node picks up the VIP within ~10 seconds
  • etcdctl endpoint status --cluster -w table shows a healthy etcd cluster with one leader
  • If you added LINSTOR: create a test PVC with ReadWriteOnce and confirm it binds and replicates
The two things that silently break clusters
In my experience the two issues that cause the most long-tail pain on fresh RKE2 installs aren't install errors — they're config drift on sysctl (one node without vm.max_map_count crashes JVM workloads in a way that looks random) and NetworkManager interfering with CNI routes after a reboot. Drop both configs in Ansible or your configuration management of choice and enforce them on every node.

Further Reading