You need to setup servers running the default Ubuntu 22.04 LTS cloud image and be able to ssh into them. The servers need to be able to communicate with each other.
The playbooks assume root access. If you can't login via root you need to configure become on the Ansible cli.
Copy the IPs of your servers into the hosts/inventory file. You need at least one IP for each: master, control_planes, worker.
Your inventory might look like this:
[master]
192.168.2.1
[control_planes]
192.168.2.2
192.168.2.3
[worker]
192.168.2.4
192.168.2.5
192.168.2.6master is just the control-plane used to boostrap the k8s cluster with kubeadm.
Change into the ansible/ directory.
To prepare the Ubuntu servers for Kubernetes, run:
ansible-playbook -i hosts -u root prepare-ubuntu-k8s-nodes.yamlAs long as the playbook doesn't fail in the setup-containerd task, it is idempotent.
Now you can create a Kubernetes cluster with:
ansible-playbook -i hosts -u root create-k8s-cluster.yamlThis playbook is NOT idempotent. Don't run it twice.
If everything worked out, you can ssh into the master-node and run:
export KUBECONFIG=/etc/kubernetes/admin.conf
kubectl get nodesWhich should print something like this:
NAME STATUS ROLES AGE VERSION
c1 Ready control-plane 20m v1.27.3
c2 Ready control-plane 18m v1.27.3
c3 Ready control-plane 18m v1.27.3
w1 Ready <none> 18m v1.27.3
w2 Ready <none> 18m v1.27.3
w3 Ready <none> 18m v1.27.3You now have bootstrapped a minimal but usable k8s-cluster.