Build a 3-node Kubernetes cluster home lab in 5 minutes (*)
I use the lightweight Kubernetes K3s on a 3-node Raspberry Pi 4 cluster. I wrote a few blog posts on how the Raspberry Pi’s are installed.
I run K3s on virtual machines.
Why virtual machines?
Virtual makes it easier to redeploy or to bring a system down and up if your want to test something.
Another reason is that I also run FreeBSD virtual machines on the Raspberry Pis.
I use Debian GNU/Linux as the Operating system with KVM/libvirt as the hypervisor.
I use Ansible to set up the cluster in an automated way. Got finality the time to clean up the code a bit and release it on Github: https://github.com/stafwag/ansible-k3s-on-vms
The code can also - and will by default - be used on x86 systems.
The playbook is a wrapper around the roles:
To set up the virtual machines.
To install and configure K3s on the virtual machines.
To enable libvirt on the vm_kvm_host
.
The sample inventory will install the virtual machines on localhost. It’s possible to install the virtual machine on multiple lbvirt/KVM hypervisors.
This should enable you setup the virtual machine with k3s in … 5 minutes
(*) if everything goes well the first time :-)
Have fun
Leave a comment