Skip to content

3 node cluster

MVK on vagrant represents a ‘real’ 3 node VM in the cloud but running on a local, self-hosted environment.

This is developed and tested on a single machine with >16G of memory, 8 cpus and around 500GB hard drive.

Your mileage may vary depending on CPU and memory but in my experience, 16Gig or more memory is better suited to this kind of work and ideally, more so. It is not uncommon to use 32Gig for a ‘home lab’ server / desktop these days.

Clone the infctl-cli repo in order to have local access to its scripts, files and manifests to use later on.

Where you put this is up to you but we will work on the assumption that this will be in $HOME/projects :

Terminal window
mkdir -p $HOME/projects/
cd $HOME/projects
git clone https://codeberg.org/headshed/infctl-cli.git
cd infctl-cli

./scripts/install_vagrant_nodes.sh will run vagrant up on what is to be your local cluster.

./scripts/configure_vagrant_k3s.sh checks and interogates the vagrant hosts to create an ansible inventory file for later use with Ansible.

vagrant/dev/ubuntu/Vagrantfile is used by vagrant to coordinate the cluster and workstation build

scripts/install_vagrant_workstation.sh brings the workstation up after the server nodes have been established

./vagrant/dev/ubuntu/ansible/provision_workstation.sh is quite a bit longer and more involved than those previous, as it is used by vagrant to provision our workstation and uses ansible scripts to :

  • ansible ping the 3 cluster nodes
  • ansible-playbook install keepalived which MVK uses as a ‘cheap loadbalancer’ by which k3s can access the current, active k8s interface
  • ansible-playbook install the 3 node k3s cluster
  • ansible-playbook install the k8s config file onto the workstation for management of k8s
  • ansible-playbook install dnsmasq for later use in development and testing the local cluster

if you are ready to run the pipeline, this can be run in a single command with infctl which we can configure to use a pipeline file at pipelines/dev/vagrant-k3s.json

This marshals each of the above tasks into a single, repeatable operation.

Terminal window
LOG_FORMAT=none infctl -f pipelines/dev/vagrant-k3s.json