Feedback

Chat Icon

End-to-End Kubernetes with Rancher, RKE2, K3s, Fleet, Longhorn, and NeuVector

The full journey from nothing to production

Understanding How K3s and RKE2 Work
19%

Joining an RKE2 Cluster as a Worker Node

We are going to install RKE2 on the worker node then configure it to join the cluster.

Start by SSHing into the worker node.

# SSH into the node
ssh root@$WORKLOAD_NODE_01_PUBLIC_IP

Install RKE2 on the worker node. Note the INSTALL_RKE2_TYPE=agent flag.

# We add INSTALL_RKE2_TYPE=agent
curl -sfL https://get.rke2.io | \
    INSTALL_RKE2_CHANNEL="stable" \
    RKE2_VERSION="v1.34.1+rke2r1" \
    INSTALL_RKE2_TYPE=agent \
    sh -

Set the token for the worker node as well as the server IP. We are using the private IP of the control plane node since both machines are in the same network. We will use p@ssword as the token since that's what we set on the control plane node. If you made any changes, make sure to reflect them here.

# Create config dir/file
mkdir -p /etc/rancher/rke2/

# Change the ip to reflect your rancher-01 ip
cat << EOF > /etc/rancher/rke2/config.yaml
server: https://$WORKLOAD_CONTROLPLANE_01_PRIVATE_IP:9345
token: p@ssword
EOF

Finally, start and enable the RKE2 agent service.

# Enable and start
systemctl enable --now rke2-agent.service

You can view the logs of the agent service to see if it joined the cluster.

End-to-End Kubernetes with Rancher, RKE2, K3s, Fleet, Longhorn, and NeuVector

The full journey from nothing to production

Enroll now to unlock all content and receive all future updates for free.