The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
The disk that is created is too small to install K3s. Disk size needs to be increased I used 32GB
Issue 3:
DO NOT START YOUR VM
Add here that you need to configure cloud init settings in the GUI. I missed this step first time.
Issue 4:
You may want to start your VM as I did to add the Proxmox VM agent. When starting a VM it gets issued a machine ID.
Prior to shuting down the VM the machine ID needs to be reset
The machine-id file does not get created if it is deleted, but it will get populated with a new value if it is empty. If the machine-id is not preset networking will fail to start.
Following this guide:
https://docs.technotim.live/posts/k3s-etcd-ansible/
The following issues were noted:
First create the VMS with this doc:
https://docs.technotim.live/posts/cloud-init-cloud-image/
Issue 1:
qm create 8000 --memory 2048 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0
This creates a VM that doesn't really have enough memory todo much once K3s is running. Recommend changing to 4GB
Issue 2:
qm importdisk 8000 focal-server-cloudimg-amd64.img local-lvm
The disk that is created is too small to install K3s. Disk size needs to be increased I used 32GB
Issue 3:
DO NOT START YOUR VM
Add here that you need to configure cloud init settings in the GUI. I missed this step first time.
Issue 4:
You may want to start your VM as I did to add the Proxmox VM agent. When starting a VM it gets issued a machine ID. Prior to shuting down the VM the machine ID needs to be reset
BUG:
You suggest:
This wil break your Ubnuntu installation! Do not delete /etc/machine-id truncate it with:
truncate -s 0 /etc/machine-id /var/lib/dbus/machine-id
The machine-id file does not get created if it is deleted, but it will get populated with a new value if it is empty. If the machine-id is not preset networking will fail to start.
Reference: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1508766
Return to creating the K3s witj Ansible:
Issue1:
cp -R k3s-ansible/inventory/sample inventory/my-cluster
There needs to be a setup where you create a directory for you files. The folder inventory is not present until you create it.
Issue2:
Edit inventory/my-cluster/group_vars/all.yml
When editing this file if you change to the latest verison if K3s by changing this line:
k3s_version: v1.23.4+k3s1.
It will break. V 1.24 appears not to work? Any thoughts.
Suggestion:
Prior to running:
ansible-playbook ./playbooks/reset.yml -i ./inventory/my-cluster/hosts.ini
Run:
ansible all -m ping -i ./inventory/my-cluster/hosts.ini
This is due to a fresh install of Ansible appearing to fail to connect until you have agrres to adding the host to knowhosts.