prerequisites

kubernetes

I am using rke2 for k8s. Follow the rke2 directions, not these. Their directions will be up to date.

Install the server

curl -sfL https://get.rke2.io | sh -
systemctl enable rke2-server
systemctl start rke2-server

Make sure to setup the environment variables to make things easier:

export PATH="${PATH}:/var/lib/rancher/rke2/bin:/var/lib/rancher/rke2/bin"
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml

Install the agents

curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="agent" sh -
systemctl enable rke2-agent
mkdir -p /etc/rancher/rke2/
vim /etc/rancher/rke2/config.yaml
systemctl start rke2-agent

Contents of the rke2/config.yaml

I’m using the external (instead of the management) IP of the server node.

server: https://<server>:9345
token: <token from server node>

Assign role to worker nodes

Run this from the server node.

kubectl label node NODE_NAME node-role.kubernetes.io/worker=worker

Remove a role from a node

kubectl label node NODE_NAME node-role.kubernetes.io/worker-

Get an alpine linux container

This will give you a shell prompt to test stuff.

kubectl run -it --tty --rm debug --image=alpine --restart=Never -- sh