Homelab high availability K3S cluster install
I’ve completed the install of a high availability K3S cluster onto the 5 Optiplex machines. Had one or two issues, that meant I had to reinstall with a new secret, but otherwise was pretty smooth!
Node | IP | Role | Notes |
---|---|---|---|
molly | 192.168.1.51 | control plane | –cluster-init |
daisy | 192.168.1.52 | control plane | joins molly |
rosie | 192.168.1.53 | control plane | joins molly |
bessy | 192.168.1.54 | worker | joins any server |
elsie | 192.168.1.55 | worker | joins any server |
Secret for all machines
You need to supply the same secret to each machine! The initially installed control plane and other control planes or agent nodes need the same secret to join the cluster.
echo "somerandomsecret" > secret
Install the initial control plane
curl -sfL https://get.k3s.io | K3S_TOKEN=$(cat secret) sh -s - server \
--cluster-init \
--disable=helm-controller
sudo systemctl status k3s.service
Additional server installs
curl -sfL https://get.k3s.io | K3S_TOKEN=$(cat secret) sh -s - server \
--server https://192.168.1.51:6443 \
--disable=helm-controller
Agent install
curl -sfL https://get.k3s.io | K3S_TOKEN=$(cat secret) sh -s - agent --server https://192.168.1.51:6443
Connecting to cluster
# remote control plane
sudo cp /etc/rancher/k3s/k3s.yaml .
# On main system
scp [email protected]:/home/matt/k3s.yaml .
vim k3s.yaml # edit IP to point to control plane
mkdir ~/.kube
mv k3s.yaml .kube/config
Uninstalling
In case you need to uninstall..
# servers
/usr/local/bin/k3s-uninstall.sh
# agents
/usr/local/bin/k3s-agent-uninstall.sh
Done! 😍
Next will be setting up Flux for GitOps!