Ansible role that automates the creation of a K3S cluster running in Multipass virtual machines.
Using this Ansible role to create a K3S cluster according to the instructions below require the following:
- Multipass
- Ansible
- Molecule
- Kubectl
From the root of this project:
- Install the collection:
ansible-galaxy collection install k3s_cluster --force
- Create a K3S cluster running in Multipass VMs as specified in the inventory.yml file in project root:
ansible-playbook -i inventory.yml k3s-cluster-create.yml
- Update kubectl configuration on the local computer as to manage the K3S cluster:
ansible-playbook -i inventory.yml kubectl-local-config.yml
- Verify K3S cluster:
kubectl cluster-info
kubectl get nodes
- Tear down the K3S cluster including deleting the Multipass VMs:
ansible-playbook -i inventory.yml k3s-cluster-teardown.yml
The K3S cluster is defined in the inventory.yml file. Currently only one master node per cluster is supported.
Please refer to the README in the k3scluster role (k3s_cluster/roles/k3scluster/README.md)
for instructions on how to set up a K3S cluster using Molecule.