This document describes the steps which have to be taken when preparing a new node to be added to the Kubernetes cluster.
For simplicity and consistency, all of our Kubernetes machines should run the latest LTS version of Ubuntu Server, with all updates installed.
As recommended by Kubernetes best practices, we disable swap and remove the swap file on all machines which also run pods, to ensure consistent performance.
We will install Rancher's RKE2 Kubernetes distribution. We prefer always using the latest version of Kubernetes, which can be installed on a Linux machine by running:
curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=latest sh -
First, follow the steps in the official documentation to safely drain a node and mark it as unschedulable:
kubectl drain --ignore-daemonsets <node name>
After waiting to ensure all services get moved off the node, you can stop RKE2 and all of its associated services by running:
rke2-killall.sh
Upgrade all system packages, cleanup old files and then upgrade the installed RKE2 version by running
curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=latest sh -
(same command as when installing it the first time)
Reboot and wait for the node to start up and rejoin the cluster.
Finally, uncordon it and allow workloads to be scheduled on it again by using:
kubectl uncordon <node name>
To remove unused images from the containerd
cache, use the command:
crictl rmi --prune