Quick and dirty ansible for deploying kubernetes with kubeadm.
Based on this guide https://www.arubacloud.com/tutorial/how-to-create-kubernetes-cluster-with-kubeadm-and-ansible-ubuntu-20-04.aspx
- Basic ansible to deploy a cluster with a single master (prepared for HA)
- HA Control Plane
- Removal of hardcoded variables such as Service/Pod CIDR Ranges
For CNI we use kube-router.
Rather than using Docker for the container runtime, we use containerd.
We are using kube-router to expose ClusterIP services to the network, running a highly available control plane, this is W.I.P.
Create an ansible inventory in hosts. Each host should be running Ubuntu 20.04.
Generate a SSH key
ssh-keygen -t rsa -m PEM -f npf-ansible -C "npf-ansible"
Add SSH key to agent
ssh-add npf-ansible
Copy SSH key to each host
ssh-copy-id -i npf-ansible npf@172.20.22.11
Execute ansible playbook initial
ansible-playbook -i hosts initial.yml --ask-become-pass
Execute ansible playbook deps
ansible-playbook -i hosts deps.yml --ask-become-pass
Execute ansible playbook deps
ansible-playbook -i hosts kubeadm-init.yml --ask-become-pass
Execute ansible playbook deps
ansible-playbook -i hosts kubeadm-join.yml --ask-become-pass