Skip to main content
Back to Projects
TerraformAnsibleProxmox VEK3sUbuntuCloud-Init

Homelab K3s Cluster Automation

Fully automated provisioning of a High-Availability K3s cluster on Proxmox VE using Terraform and Ansible.

Open Source
H

The Goal#

To build a reproducible, disposable Kubernetes environment for local development without the cost of public cloud providers. I wanted a "one-click" experience: run a script, and get a fully functioning cluster.

The Architecture#

The project combines three powerful tools to automate the entire lifecycle of the cluster:

  1. Infrastructure Layer (Terraform):

    • Interacts with the Proxmox VE API to clone Ubuntu Cloud-Init templates.
    • Dynamically provisions Virtual Machines (Masters and Workers) with defined resources (CPU/RAM).
    • Configures networking and cloud-init user data automatically.
  2. Configuration Layer (Ansible):

    • Dynamic Inventory: Automatically detects the IP addresses of the Terraform-provisioned VMs.
    • K3s Bootstrapping: Installs the K3s binary, configures the master node, and generates the join tokens.
    • Worker Join: Automates the process of joining worker nodes to the cluster.
  3. The Result:

    • A production-ready K3s Cluster running locally.
    • Zero manual SSH required—everything is handled via keys and automation.
    • Destruction and recreation of the entire cluster takes less than 5 minutes.

Found this helpful?

Share this project