Node names now contain the cluster name, fixed kubeconfig endpoint

This commit is contained in:
Max Pfeiffer
2025-09-12 21:46:50 +02:00
parent 5076f167f9
commit f80997690c
4 changed files with 11 additions and 4 deletions

View File

@@ -6,6 +6,8 @@ proxmox_target_node = "your proxmox node"
proxmox_storage_device = "samsung-ssd" proxmox_storage_device = "samsung-ssd"
# Talos Linux # Talos Linux
# Talos version needs to correspond to the install_image version in node_data
# See: https://github.com/siderolabs/terraform-provider-talos/blob/main/docs/data-sources/machine_configuration.md
talos_version = "1.11.1" talos_version = "1.11.1"
# With these variables you can configure the ISO images which are uploaded to Proxmox for initially booting the VMs # With these variables you can configure the ISO images which are uploaded to Proxmox for initially booting the VMs
talos_linux_iso_image_url = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.11.1/nocloud-amd64.iso" talos_linux_iso_image_url = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.11.1/nocloud-amd64.iso"

View File

@@ -70,4 +70,5 @@ resource "talos_cluster_kubeconfig" "this" {
depends_on = [talos_machine_bootstrap.this] depends_on = [talos_machine_bootstrap.this]
client_configuration = talos_machine_secrets.this.client_configuration client_configuration = talos_machine_secrets.this.client_configuration
node = [for k, v in var.node_data.controlplanes : k][0] node = [for k, v in var.node_data.controlplanes : k][0]
endpoint = var.cluster_vip_shared_ip
} }

View File

@@ -40,6 +40,7 @@ variable "talos_linux_iso_image_filename" {
variable "cluster_name" { variable "cluster_name" {
description = "A name to provide for the Talos cluster" description = "A name to provide for the Talos cluster"
type = string type = string
default = "talos"
} }
variable "cluster_vip_shared_ip" { variable "cluster_vip_shared_ip" {
@@ -81,16 +82,19 @@ variable "node_data" {
variable "network" { variable "network" {
description = "Network for all nodes" description = "Network for all nodes"
type = string type = string
default = "192.168.10.0/24"
} }
variable "network_gateway" { variable "network_gateway" {
description = "Network gateway for all nodes" description = "Network gateway for all nodes"
type = string type = string
default = "192.168.10.1"
} }
variable "domain_name_server" { variable "domain_name_server" {
description = "DNS for all nodes" description = "DNS for all nodes"
type = string type = string
default = "192.168.10.1"
} }
variable "vlan_tag" { variable "vlan_tag" {

View File

@@ -1,7 +1,7 @@
resource "proxmox_vm_qemu" "kubernetes_control_plane" { resource "proxmox_vm_qemu" "kubernetes_control_plane" {
depends_on = [proxmox_storage_iso.talos_linux_iso_image] depends_on = [proxmox_storage_iso.talos_linux_iso_image]
for_each = var.node_data.controlplanes for_each = var.node_data.controlplanes
name = format("kubernetes-control-plane-%s", index(keys(var.node_data.controlplanes), each.key)) name = format("%s-kubernetes-control-plane-%s", var.cluster_name, index(keys(var.node_data.controlplanes), each.key))
description = "Kubernetes Control Plane" description = "Kubernetes Control Plane"
target_node = var.proxmox_target_node target_node = var.proxmox_target_node
agent = 1 agent = 1
@@ -33,7 +33,7 @@ resource "proxmox_vm_qemu" "kubernetes_control_plane" {
slot = "virtio0" slot = "virtio0"
type = "disk" type = "disk"
storage = var.proxmox_storage_device storage = var.proxmox_storage_device
size = "10240M" size = "50G"
discard = true discard = true
} }
@@ -53,7 +53,7 @@ resource "proxmox_vm_qemu" "kubernetes_control_plane" {
resource "proxmox_vm_qemu" "kubernetes_worker" { resource "proxmox_vm_qemu" "kubernetes_worker" {
depends_on = [proxmox_storage_iso.talos_linux_iso_image] depends_on = [proxmox_storage_iso.talos_linux_iso_image]
for_each = var.node_data.workers for_each = var.node_data.workers
name = format("kubernetes-worker-%s", index(keys(var.node_data.workers), each.key)) name = format("%s-kubernetes-worker-%s", var.cluster_name, index(keys(var.node_data.workers), each.key))
description = "Kubernetes Worker Node" description = "Kubernetes Worker Node"
target_node = var.proxmox_target_node target_node = var.proxmox_target_node
agent = 1 agent = 1
@@ -85,7 +85,7 @@ resource "proxmox_vm_qemu" "kubernetes_worker" {
slot = "virtio0" slot = "virtio0"
type = "disk" type = "disk"
storage = var.proxmox_storage_device storage = var.proxmox_storage_device
size = "10240M" size = "50G"
discard = true discard = true
} }