A Terraform module for provisioning a Kubernetes cluster on Proxmox using Talos Linux. This module automates node creation, Talos configuration, and Proxmox integration, offering a secure, lightweight, and efficient environment for homelabs or production use. It simplifies the Kubernetes setup and management process.
Feel free to contact me, open an issue, or contribute to the project. Your feedback and contributions are always welcome! 🤓
terraform output --raw kubeconfig > cluster.kubeconfig
terraform output --raw talosconfig > cluster.talosconfig
First we need get the schematic id from the outputs and use that for upgrading the cluster in order to keep the extensions.
talosctl upgrade --image factory.talos.dev/installer/<SCHEMATIC_ID>:v1.9.3 --preserve
The preserve option is only needed when wanting to keep files/directories on Talos nodes (for example when using Longhorn/Rook...)
module "k8s_cluster" {
source = "../modules/k8s_cluster"
cluster = {
name = "homelab.cluster"
vm_base_id = 700
datastore = "local-lvm"
node = "pve01"
config_patches = [file("${path.module}/config_patch.yaml")]
}
image = {
version = "v1.9.1"
extensions = ["qemu-guest-agent", "iscsi-tools", "util-linux-tools"]
}
network = {
cidr = "10.10.100.0/24"
gateway = "10.10.100.1"
dns_servers = ["10.0.10.1", "1.1.1.1"]
vlan_id = 1100
}
controlplane = {
count = 1
specs = {
cpu = 2
memory = 4096
disk = 50
}
}
worker = {
count = 2
specs = {
cpu = 2
memory = 6192
disk = 50
}
}
}
# Override example
module "k8s_cluster_override" {
source = "../modules/k8s_cluster"
cluster = {
name = "homelab.cluster"
vm_base_id = 700
datastore = "local-lvm"
node = "pve01"
config_patches = [file("${path.module}/config_patch.yaml")]
}
image = {
version = "v1.9.1"
extensions = ["qemu-guest-agent", "iscsi-tools", "util-linux-tools"]
}
network = {
cidr = "10.10.100.0/24"
gateway = "10.10.100.1"
dns_servers = ["10.0.10.1", "1.1.1.1"]
vlan_id = 1100
}
controlplane = {
count = 1
specs = {
cpu = 2
memory = 4096
disk = 50
}
}
worker = {
count = 2
specs = {
cpu = 2
memory = 6192
disk = 50
}
}
overrides = {
"controlplane-1" = {
node = "pve01"
network = {
cidr = "10.10.101.0/24"
ip_address = "10.10.101.150"
gateway = "10.10.101.1"
dns_servers = ["10.0.10.1", "1.1.1.1"]
vlan_id = 1101
}
}
}
}
Name | Version |
---|---|
proxmox | >= 0.69.0, < 1.0.0 |
talos | >= 0.7.0, < 1.0.0 |
Name | Version |
---|---|
terraform | >= 1.9.2 |
proxmox | >= 0.69.0, < 1.0.0 |
talos | >= 0.7.0, < 1.0.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster | Cluster configuration | object({ |
n/a | yes |
controlplane | Specification of controlplane nodes | object({ |
n/a | yes |
image | Variable to define the image configuration for Talos machines | object({ |
n/a | yes |
network | Network configuration for nodes | object({ |
n/a | yes |
worker | Specification of worker nodes | object({ |
n/a | yes |
Name | Description |
---|---|
kubeconfig | Kubernetes kubeconfig for the cluster |
talos_cluster_health | Health status of the Talos cluster, can be used for other ressources to depend on |
talos_image_schematic_id | ID of the Talos image schematic |
talosconfig | Talos configuration file for the cluster |