Join New Worker Node to RKE2 Cluster

3 min read
Table of contents

In this article I will show you how to Join new node as Worker Node in existing RKE2 cluster. Worker nodes handle the workloads running pods, services, and applications while the control plane manages cluster state and scheduling. By joining additional worker nodes, you increase the cluster’s capacity, improve availability, and enable better workload distribution.
So, let's get started…
Environment
- Master Node
Hostname | at-rke2-1 |
Operating System | Ubuntu 22.04 (Jammy) |
vCPU | 8 (too large for testing) |
Memory | 12 GB (too large for testing) |
Disk | 60 GB |
Network | 172.20.20.65 |
- Worker Node
Hostname | at-rke2-2 |
Operating System | Ubuntu 22.04 (Jammy) |
vCPU | 4 |
Memory | 8 GB |
Disk | 40 GB |
Network | 172.20.20.66 |
Join Worker Node to RKE2 Cluster
- Mapping hosts
# exec on all nodes
nano /etc/hosts
---
172.20.20.65 at-rke2-1 at-rke2-1.at.lab rancher.at.lab
172.20.20.66 at-rke2-2 at-rke2-2.at.lab
- Update and upgrade packages
# exec on at-rke-2 nodes
apt-get update -y && apt-get upgrade -y
- Disable swap
# exec on at-rke-2 nodes
systemctl disable --now swap.target
swapoff -a
- Enable containerd modules
# exec on at-rke-2 nodes
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfilter
- Configure kernel settings
# exec on at-rke-2 nodes
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sysctl --system
- Create rke2 agent configuration file
# exec on at-rke-2 nodes
mkdir -p /etc/rancher/rke2
nano /etc/rancher/rke2/config.yaml
---
server: https://at-rke2-1.at.lab:9345
write-kubeconfig-mode: "0644"
token: [REDACTED - SAME WITH MASTER NODE]
tls-san:
- rancher.at.lab
- at-rke2-1.at.lab
- at-rke2-2.at.lab
- Update rke2 server configuration file
# exec on at-rke-1 node
nano /etc/rancher/rke2/config.yaml
---
write-kubeconfig-mode: "0644"
token: [REDACTED]
tls-san:
- rancher.at.lab
- at-rke2-1.at.lab
- at-rke2-2.at.lab
### Used for Monitoring
etcd-expose-metrics: "true"
kube-controller-manager-arg: "bind-address=0.0.0.0"
kube-scheduler-arg: "bind-address=0.0.0.0"
- Bootstrap rke2 cluster
# exec on at-rke-2 node
curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="agent" INSTALL_RKE2_VERSION=v1.32.7+rke2r1 sh -
- Enable and start rke2-agent
# exec on at-rke-2 node
systemctl enable rke2-agent.service
systemctl start rke2-agent.service
- Set worker role to at-rke2-2 node
# exec on at-rke-1 node
kubectl label node at-rke2-2 node-role.kubernetes.io/worker="true"
- Verification
# exec on at-rke-1 node
kubectl get nodes -o wide
- Operational test
# exec on at-rke-1 node
kubectl create deployment nginx-worker --image=nginx --replicas=1
kubectl expose deployment nginx-worker --port=80 --target-port=80
kubectl create ingress nginx-worker-ingress --class=nginx --rule="nginx-worker.at.lab/*=nginx-worker:80"
nano /etc/hosts
---
172.20.20.65 nginx-worker.at.lab
Thank You.
0
Subscribe to my newsletter
Read articles from Muhammad Alfian Tirta Kusuma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
