Programmatically Setup Kubernetes, Rancher, Longhorn, …

I have a home lab. On multiple occasions, I have been able to setup, manually or via scripts. Kubernetes, Rancher, Longhorn, Traefik, and Nginx. While I have always been able to complete the setup, errors always seem to enter the process.

I would like to be able to programmatically (Ansible, Teraform, ArgoCD, …):

  • provision Proxmox VMs,
  • individually be able to set up, manage, upgrade and remove:
    • a Kubernetes cluster (initially perhaps k3s, 3 control plane nodes, 2 worker nodes)
    • Rancher
    • Longhorn
    • Traefik
    • Nginx

There are a number of Youtubers who have automated a lot of the above (Christian Lempa, Techno Tim, Jim’s Garage, Jeff Geerling and several others), however, I would like to have a modular, end-to-end setup where I could setup, tear down, and re-setup the various components individually.

Any suggestions would be appreciated.

2 Likes

This is what I have used
Terraform - For provisioning infrastructure (if cloud) or some level of Configuration. In your case you could try that for Automating provisioning of Proxmox VMs
Ansible - For provisioning K8s cluster and rancher configuration.
Argocd GitOps - For Longhorn, Traefik, Nginx all components under K8s that you can manage with yaml

Once all components are there, you can orchestrate whole end to end setup by coupling each together with any CD tools like Jenkins or Github Actions workflows.

2 Likes