Setting Up A K8S Worker Cluster With K3S: Instructions, Configuration Files, And Automated Installation Tool

k8s
k3s
worker cluster
installation
master node
configuration files
high-availability
This article provides a step-by-step guide to setting up a k8s worker cluster using k3s, including instructions on joining the master node and configuration file details. It also introduces an automated installation tool called k3sup for installing k3s clusters via SSH connections. Furthermore, it offers insights into setting up a high-availability embedded datastore in a multi-server cluster.
Published

July 24, 2024


k8s worker cluster setup

k3s has different ways to form a cluster than kubeadm join.

https://docs.k3s.io/quick-start

k3s specifies the init command in /etc/systemd/system/k3s.service. (k3s-agent.service if installed as agent) usually it is k3s server.

you need to change it to k3s agent in order to join the master node, or pass additional environment variables K3S_URL=https://<node_ip>:6443 and K3S_TOKEN=<node-token> while running k3s installation script.

the node token is at /var/lib/rancher/k3s/server/node-token

the agent node still needs to configure registry mirrors at /etc/rancher/k3s/registries.yaml for successfully pulling images


k3sup can automatically install k3s cluster using ssh connection


multi server cluster setup:

https://docs.k3s.io/datastore/ha-embedded