Featured image of post RKE2: The smart Kubernetes installer

RKE2: The smart Kubernetes installer

Why I think RKE2 is one of the smartest Kubernetes installers available today.

If you need to install a Kubernetes cluster for production, the easiest way to do so is using RKE2, at least that is my opinion. It installs a rock solid cluster within minutes. And to tell you up front: this is not another quick’n dirty KinD/MicroK8s/whatever local mini test cluster; this is enterprise grade software, providing you super stable clusters for which you can obtain commercial support (or manage them on your own). From a local single-node cluster on your own laptop to giant clusters of hundreds of nodes, RKE2 allows you to run it.

Ok, this was not meant to become a sales pitch, however I really want to show you a bit of my own experience with RKE2 and why I’m so enthusiastic about it. I am a platform engineer who has worked with Kubernetes since 2017. Personally, I run a Kubernetes homelab and have some test clusters available on my laptop for testing, development and demo purposes. I designed and deployed many platforms/clusters for many customers throughout the years. I saw many ways to install and manage these, and saw lots of pain and frustration in doing this. I do not know any other Kubernetes installer/distribution that is so simple to use and automate.

Easy to install

RKE2 is simple by design. It is basically just a binary. You probably want to add a configuration file (in yaml) to make it do what you want. And finally you might need a systemd service file to make it run as a service. That’s it. Also good to know: packages are available for most Enterprise Linux distributions.

I love Infrastructure-as-Code and RKE2 really fits in there very nicely. For example, Ansible lets you easily install the three files I just mentioned and enable/start the systemd service. Within seconds your first cluster node is up and running. With a bit more Ansible code you deploy a full cluster with multiple control planes and lots of workers.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- name: Install RKE2 package
  ansible.builtin.dnf:
    name: rke2-server
    state: installed

- name: Configure RKE2
  ansible.builtin.template:
    src: config.yaml.j2
    dest: /etc/rancher/rke2/config.yaml

- name: Start cluster
  ansible.builtin.systemd:
    name: rke2-server
    state: started
    enabled: true

Ok, this is just the basic part, of course you first need to configure a few things, like the required yum repository and open up some firewall ports. This is all well documented.

RKE2 stores everything under /var/lib/rancher/rke2. In most cases I just create a separate filesystem for /var/lib/rancher to ensure there’s enough space available. The size really depends on how actively the cluster is being used, but 50-100 GiB should be enough for most use cases.

Easy to configure

RKE2 can be configured by creating a yaml file named /etc/rancher/rke2/config.yaml. Again, all options are documented and most of them are rather self explanatory. This is a simple example of some stuff you might want to configure:

1
2
3
4
5
6
# Choose Cilium for networking:
cni: cilium

# Set the cluster's CIDR ranges so that these addresses do not overlap with IP ranges in your existing network:
cluster-cidr: 172.30.0.0/16
service-cidr: 172.31.0.0/16

Many options can be changed during the lifetime of a cluster, however changing your CNI or CIDRs is generally not a good idea.

Secure by default

RKE2 started its life as RKE Government, built for the US public sector, and that shows in its security features. Out of the box it is configured to pass many of the CIS Kubernetes Benchmark checks without any manual hardening. For the final bits, add profile: cis to your config.yaml and RKE2 enforces the remaining controls, such as a restricted Pod Security Admission policy and default network policies. You only need to prepare a few things on the host, like an etcd user and some kernel parameters, which are all described in the hardening guide. On top of that, RKE2 is compiled with FIPS 140-2 validated cryptography, its container images are minimal and regularly scanned for CVEs, and SELinux is supported through a dedicated rke2-selinux policy package.

1
2
3
# Enforce the CIS hardening profile:
profile: cis
selinux: true

Easy to back up and restore

RKE2 not only installs a Kubernetes cluster, it also takes care of your etcd backups: embedded etcd-snapshots are enabled from the start, dumping your etcd content every 12 hours (keeping the last 5). This allows you to restore to a previous cluster state in case something went wrong.

Let’s do a restore for fun:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$ sudo rke2 etcd-snapshot list
Name                             Location                                                                          Size     Created
etcd-snapshot-kube101-1788256802 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-kube101-1788256802 11804704 2026-09-01T12:00:02+02:00
etcd-snapshot-kube101-1788300000 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-kube101-1788300000 11804704 2026-09-02T00:00:00+02:00
etcd-snapshot-kube101-1788343201 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-kube101-1788343201 11804704 2026-09-02T12:00:01+02:00
etcd-snapshot-kube101-1788386401 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-kube101-1788386401 11804704 2026-09-03T00:00:01+02:00
etcd-snapshot-kube101-1788429600 file:///var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-kube101-1788429600 11804704 2026-09-03T12:00:00+02:00

$ sudo systemctl stop rke2-server

$ sudo rke2 server --cluster-reset --cluster-reset-restore-path=/var/lib/rancher/rke2/server/db/snapshots/etcd-snapshot-kube101-1788256802

# (... lots of output here, including the restoration process itself ...)

$ sudo systemctl start rke2-server

As you can see, restoring to a previous cluster state is very easy to do; within minutes you’re back in business.

Simple to upgrade

Upgrading Kubernetes is often the most dreaded part of running a cluster. With RKE2 it’s just a matter of replacing the binary and restarting the service. If you installed RKE2 using packages, simply update the rke2-server or rke2-agent package and restart the service, one node at a time: control planes first, then the workers. With Ansible, that’s a version bump in your inventory and a playbook with serial: 1. Don’t forget to take a snapshot first (rke2 etcd-snapshot save), and stick to one minor Kubernetes version at a time.

Want to automate this completely? Install the System Upgrade Controller and let it upgrade your cluster from within, based on a Plan. For example, this plan keeps your control plane nodes on the latest stable release, upgrading them one by one:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
  name: server-plan
  namespace: system-upgrade
spec:
  concurrency: 1
  cordon: true
  nodeSelector:
    matchExpressions:
      - key: node-role.kubernetes.io/control-plane
        operator: In
        values:
          - "true"
  serviceAccountName: system-upgrade
  upgrade:
    image: rancher/rke2-upgrade
  channel: https://update.rke2.io/v1-release/channels/stable

A similar plan for the workers, which waits for the server plan to finish, completes the picture. If you manage your clusters with Rancher, it even does all of this for you with a single click.

Highly customizable

RKE2 is highly customizable and allows for a wide range of configuration options. But there is much more to configure than the config file can ever cover, and RKE2 offers other ways to tune your installation even further. Say you want to use Cilium CNI with RKE2 and you want to let Cilium replace the default kube-proxy in Kubernetes. To do this, first disable kube-proxy in your config.yaml:

1
2
3
4
5
cni: cilium
cluster-cidr: 172.30.0.0/16
service-cidr: 172.31.0.0/16
# Cilium does not need kube-proxy, so disable it:
disable-kube-proxy: true

Next, we need to tell Cilium to use its own kube-proxy functionality. RKE2 installs Cilium using Helm; you can customize the Helm chart’s values by creating a cilium-values.yaml file in the directory /var/lib/rancher/rke2/server/manifests:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: rke2-cilium
  namespace: kube-system
spec:
  valuesContent: |-
    kubeProxyReplacement: true
    k8sServiceHost: 127.0.0.1
    k8sServicePort: 6443

Now start RKE2 and within a few minutes you benefit from Cilium’s advanced networking capabilities without the overhead of kube-proxy.

Enterprise ready

SUSE sells subscriptions for Rancher Prime via their partners, like Qstars IT. Subscriptions include customer support, fast security updates, a trusted supply chain and direct access to engineers.

Final thoughts

If you don’t know RKE2 yet, I hope this article gave you a good first impression of what it is and how you can adapt it, whether it’s for your homelab, giant production environment or anything in between. Whether you love it or not, or have any questions, please don’t hesitate to ask me! If you hate it, let me know why!

Further reading:

Built with Hugo
Theme Stack designed by Jimmy