{"id":33126,"date":"2026-11-21T22:05:33","date_gmt":"2026-11-21T22:05:33","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=33126"},"modified":"2026-11-21T22:05:33","modified_gmt":"2026-11-21T22:05:33","slug":"install-rancher-rke2-cluster-three-nodes-manually","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/install-rancher-rke2-cluster-three-nodes-manually\/","title":{"rendered":"Install Rancher RKE2 Cluster three nodes manually"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\nhttps:\/\/gist.github.com\/devops-school\/d9dfa33093499cbde0be46418ee646c4\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What you are building<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">RKE2 (also called RKE Government) is Rancher&#039;s Kubernetes distribution. It focuses on security and compliance. Each <strong>server<\/strong> 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first server initialises the cluster. The second and third servers join it through the <strong>supervisor port 9345<\/strong> on a fixed registration address. In the example above, that address is the DNS name <code>rancher.apex.dell.com<\/code>. Every node uses the same shared <code>token<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Item<\/th><th>Example value<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td>Node 1<\/td><td>rke2node1.apex.dell.com<\/td><td>Initialises the cluster<\/td><\/tr><tr><td>Nodes 2 and 3<\/td><td>rke2node2 \/ rke2node3<\/td><td>Join as additional servers<\/td><\/tr><tr><td>Registration address<\/td><td>rancher.apex.dell.com<\/td><td>DNS name or load balancer in front of the servers<\/td><\/tr><tr><td>Shared token<\/td><td>Long random string<\/td><td>Authenticates nodes joining the cluster<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites and required ports<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>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.<\/li>\n\n\n<li>A <strong>unique hostname<\/strong> on every node. Alternatively, set <code>node-name<\/code> in <code>config.yaml<\/code>. Duplicate names stop a node from joining.<\/li>\n\n\n<li>Time synchronised on every node with chrony or NTP. Clock skew breaks etcd and TLS.<\/li>\n\n\n<li>A DNS record or load balancer for the registration address that resolves to node 1 before the other nodes join.<\/li>\n\n\n<li>Root access on every node.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Port<\/th><th>Protocol<\/th><th>Used by<\/th><\/tr><\/thead><tbody><tr><td>6443<\/td><td>TCP<\/td><td>Kubernetes API server<\/td><\/tr><tr><td>9345<\/td><td>TCP<\/td><td>RKE2 supervisor (node registration)<\/td><\/tr><tr><td>10250<\/td><td>TCP<\/td><td>kubelet<\/td><\/tr><tr><td>2379-2381<\/td><td>TCP<\/td><td>etcd client, peer and metrics<\/td><\/tr><tr><td>8472<\/td><td>UDP<\/td><td>Canal\/Flannel VXLAN<\/td><\/tr><tr><td>9099<\/td><td>TCP<\/td><td>Canal health checks<\/td><\/tr><tr><td>30000-32767<\/td><td>TCP<\/td><td>NodePort services<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> If you use a CNI other than Canal, such as Cilium or Calico, check that CNI&#039;s own port requirements as well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Corrected commands from the example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Most of the steps above work as written. A few lines will fail or mislead. Here are the corrected versions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Installing a specific version.<\/strong> In the original, <code>|\\ <\/code> 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 <code>sh<\/code>. Version strings look like <code>v1.xx.y+rke2r1<\/code>. Check the RKE2 releases page for the exact value you want.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># latest stable release<\/span>\ncurl -sfL https:<span class=\"hljs-comment\">\/\/get.rke2.io | sh -<\/span>\n\n<span class=\"hljs-comment\"># pinned version (replace with a real release tag)<\/span>\ncurl -sfL https:<span class=\"hljs-comment\">\/\/get.rke2.io | INSTALL_RKE2_VERSION=\"v1.xx.y+rke2r1\" sh -<\/span>\n\n<span class=\"hljs-comment\"># or follow a release channel<\/span>\ncurl -sfL https:<span class=\"hljs-comment\">\/\/get.rke2.io | INSTALL_RKE2_CHANNEL=stable sh -<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Disabling swap permanently.<\/strong> <code>swapoff -a<\/code> turns swap off only until the next reboot. <code>swap.target<\/code> is a static unit, so <code>systemctl disable<\/code> on it usually has no effect. Comment out the swap entries in <code>\/etc\/fstab<\/code> instead:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">swapoff -a\nsed -i.bak <span class=\"hljs-string\">'\/\\sswap\\s\/ s\/^\/#\/'<\/span> \/etc\/fstab\nfree -h   <span class=\"hljs-comment\"># Swap line should show 0B<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Where to start nodes 2 and 3.<\/strong> The original says to run <code>systemctl enable --now rke2-server.service<\/code> &quot;on the first node&quot; for the second and third nodes. That is wrong. Run it <strong>on node 2 and on node 3<\/strong>, one node at a time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Checking cluster health.<\/strong> <code>kubectl get componentstatuses<\/code> 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AppArmor.<\/strong> 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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Complete configuration for each node<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, generate a strong token once and reuse it on all three nodes. Do not use <code>my-shared-secret<\/code> in a real cluster.<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">openssl rand -hex 32<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Node 1 uses <code>\/etc\/rancher\/rke2\/config.yaml<\/code>. It has no <code>server:<\/code> line, because node 1 bootstraps the cluster:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">token<\/span>: &lt;<span class=\"hljs-selector-tag\">paste-generated-token<\/span>&gt;\n<span class=\"hljs-selector-tag\">node-name<\/span>: <span class=\"hljs-selector-tag\">rke2node1<\/span>        # <span class=\"hljs-selector-tag\">optional<\/span> <span class=\"hljs-selector-tag\">if<\/span> <span class=\"hljs-selector-tag\">hostnames<\/span> <span class=\"hljs-selector-tag\">are<\/span> <span class=\"hljs-selector-tag\">already<\/span> <span class=\"hljs-selector-tag\">unique<\/span>\n<span class=\"hljs-selector-tag\">tls-san<\/span>:\n  <span class=\"hljs-selector-tag\">-<\/span> <span class=\"hljs-selector-tag\">rancher<\/span><span class=\"hljs-selector-class\">.apex<\/span><span class=\"hljs-selector-class\">.dell<\/span><span class=\"hljs-selector-class\">.com<\/span>\n  <span class=\"hljs-selector-tag\">-<\/span> <span class=\"hljs-selector-tag\">rke2node1<\/span><span class=\"hljs-selector-class\">.apex<\/span><span class=\"hljs-selector-class\">.dell<\/span><span class=\"hljs-selector-class\">.com<\/span>\n  <span class=\"hljs-selector-tag\">-<\/span> <span class=\"hljs-selector-tag\">rke2node2<\/span><span class=\"hljs-selector-class\">.apex<\/span><span class=\"hljs-selector-class\">.dell<\/span><span class=\"hljs-selector-class\">.com<\/span>\n  <span class=\"hljs-selector-tag\">-<\/span> <span class=\"hljs-selector-tag\">rke2node3<\/span><span class=\"hljs-selector-class\">.apex<\/span><span class=\"hljs-selector-class\">.dell<\/span><span class=\"hljs-selector-class\">.com<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Nodes 2 and 3 use the same <code>\/etc\/rancher\/rke2\/config.yaml<\/code> path, plus the <code>server:<\/code> line. Change <code>node-name<\/code> on each node.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">server: https:<span class=\"hljs-comment\">\/\/rancher.apex.dell.com:9345<\/span>\ntoken: &lt;paste-generated-token&gt;\nnode-name: rke2node2        <span class=\"hljs-comment\"># rke2node3 on the third node<\/span>\ntls-san:\n  - rancher.apex.dell.com\n  - rke2node1.apex.dell.com\n  - rke2node2.apex.dell.com\n  - rke2node3.apex.dell.com<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><code>tls-san<\/code> 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> If you do not set <code>token<\/code> on node 1, RKE2 generates one. You can read it from <code>\/var\/lib\/rancher\/rke2\/server\/node-token<\/code> and copy it into the config files on nodes 2 and 3.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Starting and joining the servers<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>On node 1, run <code>systemctl enable --now rke2-server.service<\/code>. The first start pulls images and can take several minutes.<\/li>\n\n\n<li>Watch progress with <code>journalctl -u rke2-server -f<\/code> until the API server is up and node 1 shows <code>Ready<\/code>.<\/li>\n\n\n<li>Point the registration DNS name at node 1, or add node 1 to the load balancer for ports 9345 and 6443.<\/li>\n\n\n<li>On node 2, run <code>systemctl enable --now rke2-server.service<\/code>. Wait until <code>kubectl get nodes<\/code> shows it <code>Ready<\/code>.<\/li>\n\n\n<li>Repeat on node 3. Joining one server at a time keeps etcd membership changes safe.<\/li>\n\n\n<li>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.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Verifying the cluster<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On any server, set up <code>kubectl<\/code> and check the cluster. The <code>kubectl<\/code> binary is written to <code>\/var\/lib\/rancher\/rke2\/bin<\/code> the first time the service starts, so this step only works after the server is running.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">export<\/span> PATH=$PATH:<span class=\"hljs-regexp\">\/var\/<\/span>lib\/rancher\/rke2\/bin\n<span class=\"hljs-keyword\">export<\/span> KUBECONFIG=<span class=\"hljs-regexp\">\/etc\/<\/span>rancher\/rke2\/rke2.yaml\n\nkubectl <span class=\"hljs-keyword\">get<\/span> nodes -o wide\nkubectl <span class=\"hljs-keyword\">get<\/span> --raw='\/readyz?verbose'\nkubectl <span class=\"hljs-keyword\">get<\/span> pods -A<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Healthy output shows all three nodes with <code>STATUS<\/code> set to <code>Ready<\/code>, each with control-plane and etcd roles. The <code>\/readyz<\/code> check should end with <code>readyz check passed<\/code>. Every pod in <code>kube-system<\/code> should be <code>Running<\/code> or <code>Completed<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To manage the cluster from a workstation, copy <code>\/etc\/rancher\/rke2\/rke2.yaml<\/code>. In the copy, change <code>server: https:\/\/127.0.0.1:6443<\/code> to <code>https:\/\/rancher.apex.dell.com:6443<\/code>. Keep the file private, because it holds cluster-admin credentials.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common errors and fixes<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Symptom<\/th><th>Likely cause<\/th><th>Fix<\/th><\/tr><\/thead><tbody><tr><td>Node 2 or 3 hangs at start, with <code>connection refused<\/code> on 9345 in the logs<\/td><td>Firewall, or the DNS name not resolving to a running server<\/td><td>Open 9345\/6443 and test with <code>curl -k https:\/\/rancher.apex.dell.com:9345\/ping<\/code><\/td><\/tr><tr><td><code>token CA hash does not match<\/code> or <code>unauthorized<\/code><\/td><td>Different token on the joining node<\/td><td>Use exactly the same token as node 1<\/td><\/tr><tr><td><code>duplicate hostname<\/code> error<\/td><td>Two nodes share a hostname<\/td><td>Set unique hostnames or <code>node-name<\/code><\/td><\/tr><tr><td>x509 error when using kubectl remotely<\/td><td>Name not in <code>tls-san<\/code><\/td><td>Add the name and restart <code>rke2-server<\/code> on every server<\/td><\/tr><tr><td>Node stays <code>NotReady<\/code><\/td><td>CNI pods failing or VXLAN port blocked<\/td><td>Check <code>kubectl get pods -n kube-system<\/code> and open UDP 8472<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If a join fails and you need to start that node again from scratch, run the uninstall script on it: <code>\/usr\/local\/bin\/rke2-uninstall.sh<\/code>, or <code>\/opt\/rke2\/bin\/rke2-uninstall.sh<\/code> on systems where <code>\/usr\/local<\/code> is read-only. Then repeat the steps.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pin the RKE2 version on all nodes so they stay identical, and upgrade one server at a time.<\/li>\n\n\n<li>Put a TCP load balancer for 9345 and 6443 in front of the servers. It is more reliable than round-robin DNS.<\/li>\n\n\n<li>Keep the etcd snapshots that RKE2 takes automatically and copy them off the nodes. They are stored under <code>\/var\/lib\/rancher\/rke2\/server\/db\/snapshots<\/code>.<\/li>\n\n\n<li>Add worker nodes with <code>rke2-agent.service<\/code> and the same <code>server<\/code> and <code>token<\/code> settings, so the servers can be kept for the control plane.<\/li>\n\n\n<li>Keep <code>\/etc\/rancher\/rke2\/config.yaml<\/code> and the token out of public repositories.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">How many server nodes does an RKE2 HA cluster need?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is port 9345 used for in RKE2?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Where is the kubeconfig file for RKE2?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">RKE2 writes it to <code>\/etc\/rancher\/rke2\/rke2.yaml<\/code> on each server. It points to <code>127.0.0.1:6443<\/code>, so before using it remotely, change the server address to a name listed in <code>tls-san<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I have to disable firewalld to run RKE2?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why does kubectl get componentstatuses show errors on RKE2?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The componentstatuses API has been deprecated since Kubernetes 1.19 and does not reliably report the health of modern control planes. Use <code>kubectl get --raw=&#039;\/readyz?verbose&#039;<\/code> and <code>kubectl get pods -A<\/code> instead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related tutorials<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/what-is-github-actions-runner-controller\/\">What Is GitHub Actions Runner Controller?<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/category\/devops\/github\/\">More GitHub tutorials<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5204],"tags":[7042],"class_list":["post-33126","post","type-post","status-publish","format-standard","hentry","category-github","tag-rancher"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/33126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=33126"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/33126\/revisions"}],"predecessor-version":[{"id":80092,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/33126\/revisions\/80092"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=33126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=33126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=33126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}