MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Install Rancher RKE2 Cluster three nodes manually

This guide shows how to build a highly available, three-node Rancher RKE2 Kubernetes cluster by hand. All three servers run the control plane and embedded etcd. The steps above give the basic sequence. The sections below explain each stage, fix several commands that fail or are out of date, and add the firewall ports, verification checks and troubleshooting steps you need to get a working cluster.

https://gist.github.com/devops-school/d9dfa33093499cbde0be46418ee646c4

What you are building

RKE2 (also called RKE Government) is Rancher's Kubernetes distribution. It focuses on security and compliance. Each server node runs the API server, scheduler, controller manager and an embedded etcd member. The cluster in this guide has three server nodes, so etcd keeps quorum when any one node fails. Three nodes tolerate one failure. Always use an odd number of servers.

The first server initialises the cluster. The second and third servers join it through the supervisor port 9345 on a fixed registration address. In the example above, that address is the DNS name rancher.apex.dell.com. Every node uses the same shared token.

ItemExample valuePurpose
Node 1rke2node1.apex.dell.comInitialises the cluster
Nodes 2 and 3rke2node2 / rke2node3Join as additional servers
Registration addressrancher.apex.dell.comDNS name or load balancer in front of the servers
Shared tokenLong random stringAuthenticates nodes joining the cluster

Prerequisites and required ports

  • Three Linux hosts on a supported distribution, such as SLES, RHEL-compatible or Ubuntu. Each needs at least 2 CPUs and 4 GB RAM, and SSD storage is strongly recommended for etcd.
  • A unique hostname on every node. Alternatively, set node-name in config.yaml. Duplicate names stop a node from joining.
  • Time synchronised on every node with chrony or NTP. Clock skew breaks etcd and TLS.
  • A DNS record or load balancer for the registration address that resolves to node 1 before the other nodes join.
  • Root access on every node.

Instead of disabling the firewall completely, you can open only the ports RKE2 needs between the nodes. These are the ports for a default installation, which uses the Canal CNI:

PortProtocolUsed by
6443TCPKubernetes API server
9345TCPRKE2 supervisor (node registration)
10250TCPkubelet
2379-2381TCPetcd client, peer and metrics
8472UDPCanal/Flannel VXLAN
9099TCPCanal health checks
30000-32767TCPNodePort services

Note: If you use a CNI other than Canal, such as Cilium or Calico, check that CNI's own port requirements as well.

Corrected commands from the example

Most of the steps above work as written. A few lines will fail or mislead. Here are the corrected versions.

Installing a specific version. In the original, |\ escapes the space after the pipe. The shell then tries to run a command whose name starts with a space, so the install fails. Put the variable directly before sh. Version strings look like v1.xx.y+rke2r1. Check the RKE2 releases page for the exact value you want.

# latest stable release
curl -sfL https://get.rke2.io | sh -

# pinned version (replace with a real release tag)
curl -sfL https://get.rke2.io | INSTALL_RKE2_VERSION="v1.xx.y+rke2r1" sh -

# or follow a release channel
curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=stable sh -Code language: PHP (php)

Disabling swap permanently. swapoff -a turns swap off only until the next reboot. swap.target is a static unit, so systemctl disable on it usually has no effect. Comment out the swap entries in /etc/fstab instead:

swapoff -a
sed -i.bak '/\sswap\s/ s/^/#/' /etc/fstab
free -h   # Swap line should show 0BCode language: PHP (php)

Where to start nodes 2 and 3. The original says to run systemctl enable --now rke2-server.service "on the first node" for the second and third nodes. That is wrong. Run it on node 2 and on node 3, one node at a time.

Checking cluster health. kubectl get componentstatuses has been deprecated since Kubernetes 1.19 and gives unreliable results. Use the API server readiness endpoint and pod status instead. The verification section below shows how.

AppArmor. RKE2 runs with AppArmor enabled, so you do not need to disable it. The RKE2 documentation does recommend turning off firewalld, or opening the ports in the table above. If NetworkManager is active, configure it to ignore the CNI interfaces.

Complete configuration for each node

First, generate a strong token once and reuse it on all three nodes. Do not use my-shared-secret in a real cluster.

openssl rand -hex 32

Node 1 uses /etc/rancher/rke2/config.yaml. It has no server: line, because node 1 bootstraps the cluster:

token: <paste-generated-token>
node-name: rke2node1        # optional if hostnames are already unique
tls-san:
  - rancher.apex.dell.com
  - rke2node1.apex.dell.com
  - rke2node2.apex.dell.com
  - rke2node3.apex.dell.comCode language: CSS (css)

Nodes 2 and 3 use the same /etc/rancher/rke2/config.yaml path, plus the server: line. Change node-name on each node.

server: https://rancher.apex.dell.com:9345
token: <paste-generated-token>
node-name: rke2node2        # rke2node3 on the third node
tls-san:
  - rancher.apex.dell.com
  - rke2node1.apex.dell.com
  - rke2node2.apex.dell.com
  - rke2node3.apex.dell.comCode language: PHP (php)

tls-san adds extra names to the API server certificate. That lets clients connect through the shared DNS name or a load balancer without certificate errors. Every name or IP you plan to use in a kubeconfig must be in this list.

Note: If you do not set token on node 1, RKE2 generates one. You can read it from /var/lib/rancher/rke2/server/node-token and copy it into the config files on nodes 2 and 3.

Starting and joining the servers

  1. On node 1, run systemctl enable --now rke2-server.service. The first start pulls images and can take several minutes.
  2. Watch progress with journalctl -u rke2-server -f until the API server is up and node 1 shows Ready.
  3. Point the registration DNS name at node 1, or add node 1 to the load balancer for ports 9345 and 6443.
  4. On node 2, run systemctl enable --now rke2-server.service. Wait until kubectl get nodes shows it Ready.
  5. Repeat on node 3. Joining one server at a time keeps etcd membership changes safe.
  6. Add nodes 2 and 3 to the round-robin DNS record or load balancer pool so the registration address survives the loss of node 1.

Verifying the cluster

On any server, set up kubectl and check the cluster. The kubectl binary is written to /var/lib/rancher/rke2/bin the first time the service starts, so this step only works after the server is running.

export PATH=$PATH:/var/lib/rancher/rke2/bin
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml

kubectl get nodes -o wide
kubectl get --raw='/readyz?verbose'
kubectl get pods -ACode language: JavaScript (javascript)

Healthy output shows all three nodes with STATUS set to Ready, each with control-plane and etcd roles. The /readyz check should end with readyz check passed. Every pod in kube-system should be Running or Completed.

To manage the cluster from a workstation, copy /etc/rancher/rke2/rke2.yaml. In the copy, change server: https://127.0.0.1:6443 to https://rancher.apex.dell.com:6443. Keep the file private, because it holds cluster-admin credentials.

Common errors and fixes

SymptomLikely causeFix
Node 2 or 3 hangs at start, with connection refused on 9345 in the logsFirewall, or the DNS name not resolving to a running serverOpen 9345/6443 and test with curl -k https://rancher.apex.dell.com:9345/ping
token CA hash does not match or unauthorizedDifferent token on the joining nodeUse exactly the same token as node 1
duplicate hostname errorTwo nodes share a hostnameSet unique hostnames or node-name
x509 error when using kubectl remotelyName not in tls-sanAdd the name and restart rke2-server on every server
Node stays NotReadyCNI pods failing or VXLAN port blockedCheck kubectl get pods -n kube-system and open UDP 8472

If a join fails and you need to start that node again from scratch, run the uninstall script on it: /usr/local/bin/rke2-uninstall.sh, or /opt/rke2/bin/rke2-uninstall.sh on systems where /usr/local is read-only. Then repeat the steps.

Best practices

  • Pin the RKE2 version on all nodes so they stay identical, and upgrade one server at a time.
  • Put a TCP load balancer for 9345 and 6443 in front of the servers. It is more reliable than round-robin DNS.
  • Keep the etcd snapshots that RKE2 takes automatically and copy them off the nodes. They are stored under /var/lib/rancher/rke2/server/db/snapshots.
  • Add worker nodes with rke2-agent.service and the same server and token settings, so the servers can be kept for the control plane.
  • Keep /etc/rancher/rke2/config.yaml and the token out of public repositories.

Frequently asked questions

How many server nodes does an RKE2 HA cluster need?

At least three, and always an odd number, because embedded etcd needs a majority to keep quorum. Three servers tolerate the loss of one node.

What is port 9345 used for in RKE2?

It is the RKE2 supervisor port. New server and agent nodes use it to register with the cluster. It must be reachable on the registration address from every joining node.

Where is the kubeconfig file for RKE2?

RKE2 writes it to /etc/rancher/rke2/rke2.yaml on each server. It points to 127.0.0.1:6443, so before using it remotely, change the server address to a name listed in tls-san.

Do I have to disable firewalld to run RKE2?

The RKE2 documentation recommends disabling firewalld. If your security policy requires a host firewall, you can instead open the required ports between nodes: 6443, 9345, 10250, 2379-2381, UDP 8472 and the NodePort range.

Why does kubectl get componentstatuses show errors on RKE2?

The componentstatuses API has been deprecated since Kubernetes 1.19 and does not reliably report the health of modern control planes. Use kubectl get --raw='/readyz?verbose' and kubectl get pods -A instead.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Top 10 Kubernetes Management Tools in 2026: K9s vs Headlamp vs Lens vs Rancher

A Complete Guide for DevOps Engineers, SREs, Platform Engineers and Kubernetes Administrators Kubernetes has become the foundation of modern cloud-native infrastructure. From startups running a handful of…

Read More

Kubernetes storageclass using Rancher Local Path Provisioner: Complete Step-by-Step Kubernetes Tutorial

Goal: Automatically provision hostPath-backed PersistentVolumes (PVs) for a 3-replica StatefulSet on a self-managed Ubuntu Kubernetes cluster, without hand-writing a PV or a PVC manifest. Lab setting Value Kubernetes v1.35.10 (self-managed / kubeadm-style installation)…

Read More

Kubernetes Setup Options: The Complete Guide from Local Labs to Enterprise Production

Kubernetes Setup Options: The Complete Guide from Local Labs to Enterprise Production Kubernetes can be installed in many different ways. The right approach depends on your goal:…

Read More

Top 10 Kubernetes Management Platforms: Features, Pros, Cons & Comparison

Introduction Kubernetes has become the backbone of modern cloud-native infrastructure. While Kubernetes itself is powerful, managing clusters at scale is complex, time-consuming, and often overwhelming without the…

Read More

Centralized Multi-Cluster Kubernetes Management for Multi-Tenancy: In-Depth Tutorial

Modern organizations increasingly run applications across multiple Kubernetes clustersโ€”whether for scaling, geo-redundancy, hybrid/multi-cloud, or secure multi-tenancy. Centralized management streamlines this complexity by unifying control, policy, and visibility…

Read More

Docker Desktop vs Rancher Desktop โ€“ Comprehensive Comparison

When comparing Docker Desktop vs Rancher Desktop, especially in 2026 with Apple Silicon, open-source trends, and license changes in mind, it’s important to break down all key…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
3 months ago

A valuable addition would be guidance on post-installation cluster validation. Successfully bringing up a three-node RKE2 cluster is only the beginning; it’s equally important to verify node readiness, network communication, DNS resolution, storage functionality, and workload scheduling before considering the cluster production-ready. Establishing a standard health-check checklist after installation can help identify configuration issues early and reduce troubleshooting effort later.

1
0
Would love your thoughts, please comment.x
()
x