You've heard of kubespray; the production ready Ansible playbook to manage Kubernetes clusters... Now get ready for:
The, not-production ready, Ansible playbook to create a vanilla kubeadm configured cluster.
Kubeleak is a very light-weight, minimalist way, to deploy a 3 node Kubernetes cluster on Ubuntu 20.04 LTS.
I wanted a very opinionated way to build bare metal Kubernetes using kubeadm for side projects. Mainly for the ability to quickly identify every component of the playbook and be able to make adjustments.
To be extremely clear, kubeleak is NOT better than kubespray, it is just easier to grok. USE AT YOUR OWN RISK!
inventory.yaml -> playbooks/ -> kubeadmin-config.j2 template -> GitOps.
- Install Ansible
- Copy SSH keys to each of the nodes
- Verify a key exists or create one.
ssh-copy-id USER@NODE_IP_ADDRESS_1ssh-copy-id USER@NODE_IP_ADDRESS_2ssh-copy-id USER@NODE_IP_ADDRESS_3
- Clone this repo && cd
- Update
inventory.yamlwith IPs and custom variables - Test:
ansible all -m ping - Run:
ansible-playbook playbooks/update.yaml -Kto update all nodes (general)- The
-Kforce's ansible to ask you to type the password for sudo, "the BECOME password." An alternative would be to add your user to the WHEEL file so it never prompts for a password.
- The
- Run:
ansible-playbook playbooks/set-k8s-version.yaml -Kto update / force the Kubernetes version installed (as set bykubernetes_versionininventory.yaml). - Run:
ansible-playbook playbooks/install-k8s.yaml -Kto install Kubernetes using thetemplates/kubeadm-config.j2file.
You now have a basic running kubeadm cluster! Log in to the control plane node to run kubectl commands or copy the /etc/kubernetes/admin.conf kubeconfig.
There's another playbook in there automate-upgrades.yaml that is used for another side project of mine (isitstillrunning.com). A lot of the playbook(s) are modified from a tutorial for "Installing Kubernetes Cluster with Ansible on Ubuntu in 5 minutes."
Don't forget to make backups!