Kubernetes (RKE2)

arthurkay

Arthur

Posted on August 17, 2023

Kubernetes (RKE2)

This guide will help you quickly launch a cluster with default options for Rancher Kubernetes Engine

Prerequisites

Make sure your environment fulfills the requirements. If NetworkManager is installed and enabled on your hosts, ensure that it is configured to ignore CNI-managed interfaces.

NOTE: For RKE2 versions 1.21 and higher, if the host kernel supports AppArmor, the AppArmor tools (usually available via the apparmor-parser package) must also be present prior to installing RKE2.

The RKE2 installation process must be run as the root user or through sudo.

Server Node Installation

RKE2 provides an installation script that is a convenient way to install it as a service on systemd based systems. This script is available at https://get.rke2.io. To install RKE2 using this method do the following:

1. Run the installer

curl -sfL https://get.rke2.io | sh -
Enter fullscreen mode Exit fullscreen mode

This will install the rke2-server service and the rke2 binary onto your machine. Due to its nature, It will fail unless it runs as the root user or through sudo.

2. Enable the rke2-server service

systemctl enable rke2-server.service
Enter fullscreen mode Exit fullscreen mode

3. Start the service

systemctl start rke2-server.service
Enter fullscreen mode Exit fullscreen mode

4. Follow the logs, if you like

journalctl -u rke2-server -f
Enter fullscreen mode Exit fullscreen mode

Conclusion:

The rke2-server service will be installed. The rke2-server service will be configured to automatically restart after node reboots or if the process crashes or is killed.
Additional utilities will be installed at /var/lib/rancher/rke2/bin/.

They include: kubectl, crictl, and ctr. Note that these are not on your path by default.

Two cleanup scripts, rke2-killall.sh and rke2-uninstall.sh, will be installed to the path at:

/usr/local/bin for regular file systems

/opt/rke2/bin for read-only and brtfs file systems

INSTALL_RKE2_TAR_PREFIX/bin if INSTALL_RKE2_TAR_PREFIX is set

A kubeconfig file will be written to /etc/rancher/rke2/rke2.yaml.

A token that can be used to register other servers or agent nodes will be created at /var/lib/rancher/rke2/server/node-token

💖 💪 🙅 🚩
arthurkay
Arthur

Posted on August 17, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related