Lightweight HA Kubernetes with k3s & kube-vip¶
Perfect kuberntes cluster for homelabs¶
- k3s is lightweight kubernetes, easy to install, 50% memory, single binary of less than 100 MB.
- kube-vip provides kubernetes clusters with a virtual IP for the control plane
- k3sup is a light-weight utility to get from zero to KUBECONFIG with k3s on any local or remote VM
Prerequsites¶
System Requirements
Five (5) linux virtual machines with statically configured IPs. It is recommended that the virtual machines have an A Record pointing to the IP address of the host.
A floating IP Address for the Virtual IP to access the cluster. It is recommended that to have an A Record pointing to the floating IP Address.
You will also need a linux host that you will deploy the server and agent nodes from.
Install k3sup¶
First you will need to install k3sup which is what we will use to deploy the server and agent nodes from.
k3sup uses ssh to connect to the server and agent nodes so we need to copy our public key.Next we deploy a k3s sever node to the first node
Server Node 2
k3sup join --ip 192.168.1.22 --user dmistry --sudo --k3s-channel stable --server --server-ip 192.168.1.20 --server-user dmistry --sudo --k3s-extra-args "--disable traefik --disable servicelb --node-ip=192.168.1.22"
Server Node 3
Next we configure the agent nodes
k3sup join --ip 192.168.1.23 --user dmistry --sudo --k3s-channel stable --server --server-ip 192.168.1.20 --server-user dmistry --sudo --k3s-extra-args "--disable traefik --disable servicelb --node-ip=192.168.1.23"
Agent Node 2
k3sup join --user dmistry --sudo --server-ip 192.168.1.20 --ip 192.168.1.24 --k3s-channel stable -- --k3s-extra-args "--disable traefik --disable servicelb" --print-command
Agent Node 2
k3sup join --user dmistry --sudo --server-ip 192.168.1.20 --ip 192.168.1.25 --k3s-channel stable -- --k3s-extra-args "--disable traefik --disable servicelb" --print-command
You can now download the kubeconfig from server node 1 and update the IP adderss to match the load balancer IP (192.168.1.20)