Merge pull request #1 from max-pfeiffer/feature/update-talos-setup
Update talos setup
This commit is contained in:
96
proxmox/.terraform.lock.hcl
generated
96
proxmox/.terraform.lock.hcl
generated
@@ -1,65 +1,65 @@
|
||||
# This file is maintained automatically by "tofu init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.opentofu.org/opentofu/local" {
|
||||
version = "2.5.1"
|
||||
constraints = "2.5.1"
|
||||
provider "registry.opentofu.org/hashicorp/local" {
|
||||
version = "2.5.3"
|
||||
constraints = "2.5.3"
|
||||
hashes = [
|
||||
"h1:87L+rpGao062xifb1VuG9YVFwp9vbDP6G2fgfYxUkQs=",
|
||||
"zh:031c2c2070672b7e78e0aa15560839278dc57fe7cf1e58a617ac13c67b31d5fb",
|
||||
"zh:1ef64ea4f8382cd538a76f3d319f405d18130dc3280f1c16d6aaa52a188ecaa4",
|
||||
"zh:422ce45691b2f384dbd4596fdc8209d95cb43d85a82aaa0173089d38976d6e96",
|
||||
"zh:7415fbd8da72d9363ba55dd8115837714f9534f5a9a518ec42268c2da1b9ed2f",
|
||||
"zh:92aa22d071339c8ef595f18a9f9245c287266c80689f5746b26e10eaed04d542",
|
||||
"zh:9cd0d99f5d3be835d6336c19c4057af6274e193e677ecf6370e5b0de12b4aafe",
|
||||
"zh:a8c1525b389be5809a97f02aa7126e491ba518f97f57ed3095a3992f2134bb8f",
|
||||
"zh:b336fa75f72643154b07c09b3968e417a41293358a54fe03efc0db715c5451e6",
|
||||
"zh:c66529133599a419123ad2e42874afbd9aba82bd1de2b15cc68d2a1e665d4c8e",
|
||||
"zh:c7568f75ba6cb7c3660b69eaab8b0e4278533bd9a7a4c33ee6590cc7e69743ea",
|
||||
"h1:31Clmfoe7hzkcdgwuhUuGuPGfeG2Ksk+YWcJgzBTN7M=",
|
||||
"zh:32e1d4b0595cea6cda4ca256195c162772ddff25594ab4008731a2ec7be230bf",
|
||||
"zh:48c390af0c87df994ec9796f04ec2582bcac581fb81ed6bb58e0671da1c17991",
|
||||
"zh:4be7289c969218a57b40902e2f359914f8d35a7f97b439140cb711aa21e494bd",
|
||||
"zh:4cf958e631e99ed6c8b522c9b22e1f1b568c0bdadb01dd002ca7dffb1c927764",
|
||||
"zh:7a0132c0faca4c4c96aa70808effd6817e28712bf5a39881666ac377b4250acf",
|
||||
"zh:7d60de08fac427fb045e4590d1b921b6778498eee9eb16f78c64d4c577bde096",
|
||||
"zh:91003bee5981e99ec3925ce2f452a5f743827f9d0e131a86613549c1464796f0",
|
||||
"zh:9fe2fe75977c8149e2515fb30c6cc6cfd57b225d4ce592c570d81a3831d7ffa3",
|
||||
"zh:e210e6be54933ce93e03d0994e520ba289aa01b2c1f70e77afb8f2ee796b0fe3",
|
||||
"zh:e8793e5f9422f2b31a804e51806595f335b827c9a38db18766960464566f21d5",
|
||||
]
|
||||
}
|
||||
|
||||
provider "registry.opentofu.org/siderolabs/talos" {
|
||||
version = "0.7.0-alpha.0"
|
||||
constraints = "0.7.0-alpha.0"
|
||||
version = "0.9.0"
|
||||
constraints = "0.9.0"
|
||||
hashes = [
|
||||
"h1:RMoURrHNTK/4ofsYr803w/GZIk/W4BtkR9tPcHeqkzw=",
|
||||
"zh:090d86eee971ac84a1d6999d1ccdb1323f257ced6aec068ac39f621d9410baad",
|
||||
"h1:50TaymX/KnjXcURmpKsVd7JUyLRrMDNXMHFgqzSe88U=",
|
||||
"zh:0fa82a384b25a58b65523e0ea4768fa1212b1f5cfc0c9379d31162454fedcc9d",
|
||||
"zh:3de44dd80dee28b4e5840886167b2a0abab16dd8aefa1d387f913e57723bf74a",
|
||||
"zh:3eb60ee11290e32cb436aa6c2801fe16f436388ee3578f913656776590634835",
|
||||
"zh:5d31feb8a7782a5f77cfd7e4447f731d9f69c9350a1cf08ec98b66bd014bbb2a",
|
||||
"zh:6b0c1d0965fd256ac38911add83a95a179d69843978956c5a2980c073f209b8d",
|
||||
"zh:75431c28ac8a09243291e95d9ce93ae250bc77e1e40c81e94b84639dfca3e492",
|
||||
"zh:7f26210ddc7af32737756ce214b208218a2c1679475e3eb49504543911e7d9ad",
|
||||
"zh:8e5b685a8db6ddb28db84df076729389a3fb8cbe0576f996ab7e0a0a31220b4e",
|
||||
"zh:b441337a78d2fbcea9cf0261ddc45599dd332459700e87484f1258d656399f6a",
|
||||
"zh:bbb54c313bf26845b012d3d74f4d300cea96dbb2d7410e7210e64cb0be2d1f60",
|
||||
"zh:c7991f7c27762ba17404ee6b666e7b66c6cd8bf24f01103c0d2ed96a40021b5e",
|
||||
"zh:d8901ba224dc14f4d6cab1509a4d2f7bd87958fa3d7840c70f59fa2967f77515",
|
||||
"zh:dc425e059399527f44e493cc8a078244065b4c0f5a77bbd9f00f3b47fb4a27d3",
|
||||
"zh:de3b15a809b49ef9fee77f9f864c2ed1bdbfa62fc258c59473169269f354d8f5",
|
||||
"zh:249ab08b810bb96ef7c35354a12622907df7cbda59c83ff314ee85e8b851128d",
|
||||
"zh:4f284c21f0cb4b7012fdb231ebba4803e5c389f7ea380fb5958ebfa6b822d055",
|
||||
"zh:6049f8d06bc92ab1a46d56c2b37799e6a1b7ce3c61905acf8f0c2009942be8ac",
|
||||
"zh:7de5f0a6429c6856ade3c7e59d5041a7fe8e0010aea14a2074e91f8a526283ce",
|
||||
"zh:9760420cf5feec0550556664962bc6f1af45115b9ea5bcbf47aa9bffd3dd4ac2",
|
||||
"zh:9860272a9fbcea65393c478dc579ad2677a44338de24677702ce699a027801aa",
|
||||
"zh:a60311a8bf267b18dcf1c8250f45e371b51c6aef086e037a3f9496602f190187",
|
||||
"zh:b74c119b2a964cae8d17b5b5f14c8eecf44708e3817c1f65ac89b813856aed98",
|
||||
"zh:bc33e14650052c246ac2e6492a0a24755d4e8d27cb7259e3996f07b0537f2c77",
|
||||
"zh:c4bc2c65b3dcef2508c14dbbfc18937c5ede11670c02a644cbc28c83a57de92b",
|
||||
"zh:c98bf4809220568d76ea2db232a88a60c29fd90d4c9e2f8c8a68cf91ceed066a",
|
||||
"zh:de0179ee9c55bf36d3474049ceac3a105ed7bc1fb9c4787d4076c4b15d268b66",
|
||||
"zh:e99e019d950131c2c4259c1cbca1d072cb813bdfdbbbf9359f5901d6b7542a0d",
|
||||
"zh:feb941cc673692c6858f96590f3ca082683a62aa2d2842b9bfffcd327eb840d3",
|
||||
]
|
||||
}
|
||||
|
||||
provider "registry.opentofu.org/telmate/proxmox" {
|
||||
version = "3.0.1-rc4"
|
||||
constraints = "3.0.1-rc4"
|
||||
version = "3.0.2-rc04"
|
||||
constraints = "3.0.2-rc04"
|
||||
hashes = [
|
||||
"h1:tcfqcTB5TDQKSGrWksACZdFIX6ig72i++OYaC8EncOU=",
|
||||
"zh:1070aff02aebeadf130368b0082e76d976f61464b3bb29c1c5a7866bb14c7380",
|
||||
"zh:3cd96c232a12cf3bbb0e874508e5ff14116ef347d60db20db17ad87bb161ee22",
|
||||
"zh:4f75954f3e68159ed969e3eac27485166103058eff3f99186d805816c6f8eb66",
|
||||
"zh:55572fd22f7c62813a691fe0d017b2a57a34f3b4e1c40af6c2197731878ebf84",
|
||||
"zh:6536402b2eff0a754ff975c39318c3c0b47dfa2dc4461d34a8c55ba493288d9f",
|
||||
"zh:735f4283286cb78fe28b4ad001771c460f1963ee640e027467eb199d80a6c257",
|
||||
"zh:90a675455c5812d90acbf44bfee347c2318b13565c68bcf64b452dbe6c2a629a",
|
||||
"zh:9bbfe89d3f0997a26d7636d5c2d7244beccf92371d17073583299b1b74e1ab9c",
|
||||
"zh:9ed8ecb50c4ed8555ffe1544325de07db678e2877f7c4637fbfaf02d5f004100",
|
||||
"zh:b1e362ebd234aa82a38ffcfa4e74295e8a23811edff8af88f79372ba18ef0918",
|
||||
"zh:c652faede363a91ad3a148cdd1b3d9c3ab8bac1b94d92ce89eb6e1ddadc99cc1",
|
||||
"zh:d803958e5e465095cc0d5741abf0abd80b5fd3d1c076b40880a136e737bb06d0",
|
||||
"zh:fa12bd372e39c8ac6295503f88884f328971834e109fcc015322fc9ab5fe858f",
|
||||
"zh:fb7abe461d36f9868a0a6728320e482ecd54e047c2876dce85d5c2143eba3b8f",
|
||||
"h1:ZPr93UUVOw1aCqsODLXsqNQ9Lq/WafX5jgCCLxKBHl4=",
|
||||
"zh:00586a3e02061734f5ff4c309696ec1bbd6e00a7ed1281c44626f02929417f6e",
|
||||
"zh:05af12aababd0a67a95309a803123f3c238b16ecdb73dc59c8d9c3d4a0b691c5",
|
||||
"zh:4b6457bd0138f5c66c8b7043bdbffe3b8abcce2383293d77f653dbd77d14428f",
|
||||
"zh:7b1b6e76d6b03c7829b8dadeb30de236782be314f5146d9f29ee12bd01961d7a",
|
||||
"zh:87c21e0a8244b73c62ad3221773ec1c72fb918e0025b0664183a8ad8bebeb5bc",
|
||||
"zh:954997c550285dfc167977683b97b045dd62923c251fad32c4ca81b564c2005f",
|
||||
"zh:98781ef0199877580256e9f9a7f0666107f76af23f54f67d6392a66a6f5001b5",
|
||||
"zh:9fc4dbd1752e2b9125223be2dd25597c0e6d534aa784c4829af3c3e3e58eb973",
|
||||
"zh:a3f672019aee2d45c202668b95c48113e3c50001b740bd48956738ad1418c6b7",
|
||||
"zh:a539852a4034132442e6dc6f644444994d83b0dc7a4d30bbe6464de420cfdf2d",
|
||||
"zh:aade0b50a559a1da683c49ec8527e5e66b12ed42d4b1f10e69b25cbbf6c67805",
|
||||
"zh:bdb7c2b78cfe039247948fa75fad49f871f8a8bb9b969aec4c45a24edc80ab0f",
|
||||
"zh:c16209a6748f87a379a5a3132ca4f471a4807bd478664499593e09433ba39b7b",
|
||||
"zh:cb015fb4a0a50d151c35c6a3505cdf7a337edd0b65eba82a43c8142c523adfb8",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,58 @@
|
||||
proxmox_api_url = "https://192.168.1.10:8006/api2/json"
|
||||
# Proxmox
|
||||
proxmox_api_url = "https://192.168.1.25:8006/api2/json"
|
||||
proxmox_api_token_id = "root@pam!supersecret"
|
||||
proxmox_api_token_secret = "js7ej5k9-hd75-hd64-js56-js834jmd732"
|
||||
proxmox_target_node = "your proxmox node"
|
||||
proxmox_storage_device = "samsung-ssd"
|
||||
|
||||
# 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"
|
||||
# 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_filename = "talos-linux-v1.11.1-qemu-guest-agent-amd64.iso"
|
||||
# Name of the cluster
|
||||
cluster_name = "your cluster name"
|
||||
cluster_endpoint = "https://192.168.1.100:6443"
|
||||
# VIP address for the control planes, see https://www.talos.dev/v1.11/talos-guides/network/vip/
|
||||
cluster_vip_shared_ip = "192.168.10.100"
|
||||
# The node configuration, adjust it to your liking
|
||||
node_data = {
|
||||
controlplanes = {
|
||||
"192.168.10.101" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
"192.168.10.102" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
"192.168.10.103" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
}
|
||||
workers = {
|
||||
"192.168.10.104" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
"192.168.10.105" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
"192.168.10.106" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
"192.168.10.107" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
}
|
||||
}
|
||||
# Network configuration, which is applied to all nodes
|
||||
network = "192.168.10.0/24"
|
||||
network_gateway = "192.168.10.1"
|
||||
domain_name_server = "192.168.10.1"
|
||||
vlan_tag = 10 # Optional: if you don't specify it no Vlan tag is set for the virtual machines
|
||||
@@ -1,2 +0,0 @@
|
||||
cluster:
|
||||
allowSchedulingOnControlPlanes: true
|
||||
@@ -1,6 +1,6 @@
|
||||
resource "proxmox_storage_iso" "talos_linux_iso_image" {
|
||||
url = local.talos_linux_iso_image_url
|
||||
filename = local.talos_linux_iso_image_filename
|
||||
url = var.talos_linux_iso_image_url
|
||||
filename = var.talos_linux_iso_image_filename
|
||||
storage = "local"
|
||||
pve_node = var.proxmox_target_node
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
locals {
|
||||
repo_root = "${dirname(abspath(path.root))}"
|
||||
|
||||
# Talos Linux
|
||||
talos_linux_iso_image_url = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.8.2/nocloud-amd64.iso"
|
||||
talos_linux_iso_image_filename = "talos-linux-v1.8.2-qemu-guest-agent-amd64.iso"
|
||||
talos_linux_image_reference = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
|
||||
|
||||
# K8s control plane
|
||||
k8s_control_plane_ip_address = "192.168.1.150"
|
||||
|
||||
# K8s worker 1
|
||||
k8s_worker_1_ip_address = "192.168.1.151"
|
||||
|
||||
# K8s worker 2
|
||||
k8s_worker_2_ip_address = "192.168.1.152"
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
local = {
|
||||
source = "opentofu/local"
|
||||
version = "2.5.1"
|
||||
source = "hashicorp/local"
|
||||
version = "2.5.3"
|
||||
}
|
||||
proxmox = {
|
||||
source = "telmate/proxmox"
|
||||
version = "3.0.1-rc4"
|
||||
version = "3.0.2-rc04"
|
||||
}
|
||||
talos = {
|
||||
source = "siderolabs/talos"
|
||||
version = "0.7.0-alpha.0"
|
||||
version = "0.9.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,24 @@ resource "talos_machine_secrets" "this" {}
|
||||
|
||||
data "talos_machine_configuration" "controlplane" {
|
||||
cluster_name = var.cluster_name
|
||||
cluster_endpoint = var.cluster_endpoint
|
||||
cluster_endpoint = "https://${var.cluster_vip_shared_ip}:6443"
|
||||
machine_type = "controlplane"
|
||||
machine_secrets = talos_machine_secrets.this.machine_secrets
|
||||
talos_version = var.talos_version
|
||||
}
|
||||
|
||||
data "talos_machine_configuration" "worker" {
|
||||
cluster_name = var.cluster_name
|
||||
cluster_endpoint = var.cluster_endpoint
|
||||
cluster_endpoint = "https://${var.cluster_vip_shared_ip}:6443"
|
||||
machine_type = "worker"
|
||||
machine_secrets = talos_machine_secrets.this.machine_secrets
|
||||
talos_version = var.talos_version
|
||||
}
|
||||
|
||||
data "talos_client_configuration" "this" {
|
||||
cluster_name = var.cluster_name
|
||||
client_configuration = talos_machine_secrets.this.client_configuration
|
||||
endpoints = [for k, v in var.node_data.controlplanes : k]
|
||||
endpoints = concat([var.cluster_vip_shared_ip], [for k, v in var.node_data.controlplanes : k])
|
||||
}
|
||||
|
||||
resource "talos_machine_configuration_apply" "controlplane" {
|
||||
@@ -27,12 +29,15 @@ resource "talos_machine_configuration_apply" "controlplane" {
|
||||
for_each = var.node_data.controlplanes
|
||||
node = each.key
|
||||
config_patches = [
|
||||
templatefile("${path.module}/templates/machine_config_patches.tftpl", {
|
||||
templatefile("${path.module}/templates/machine_config_patches_controlplane.tftpl", {
|
||||
hostname = each.value.hostname == null ? format("%s-cp-%s", var.cluster_name, index(keys(var.node_data.controlplanes), each.key)) : each.value.hostname
|
||||
install_disk = each.value.install_disk
|
||||
install_image = each.value.install_image
|
||||
ip_address = "${each.key}/24"
|
||||
network = var.network
|
||||
network_gateway = var.network_gateway
|
||||
vip_shared_ip = var.cluster_vip_shared_ip
|
||||
}),
|
||||
file("${path.module}/files/cp-scheduling.yaml"),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -43,10 +48,13 @@ resource "talos_machine_configuration_apply" "worker" {
|
||||
for_each = var.node_data.workers
|
||||
node = each.key
|
||||
config_patches = [
|
||||
templatefile("${path.module}/templates/machine_config_patches.tftpl", {
|
||||
templatefile("${path.module}/templates/machine_config_patches_worker.tftpl", {
|
||||
hostname = each.value.hostname == null ? format("%s-worker-%s", var.cluster_name, index(keys(var.node_data.workers), each.key)) : each.value.hostname
|
||||
install_disk = each.value.install_disk
|
||||
install_image = each.value.install_image
|
||||
ip_address = "${each.key}/24"
|
||||
network = var.network
|
||||
network_gateway = var.network_gateway
|
||||
})
|
||||
]
|
||||
}
|
||||
@@ -62,4 +70,5 @@ resource "talos_cluster_kubeconfig" "this" {
|
||||
depends_on = [talos_machine_bootstrap.this]
|
||||
client_configuration = talos_machine_secrets.this.client_configuration
|
||||
node = [for k, v in var.node_data.controlplanes : k][0]
|
||||
endpoint = var.cluster_vip_shared_ip
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
machine:
|
||||
install:
|
||||
disk: ${install_disk}
|
||||
image: ${install_image}
|
||||
network:
|
||||
hostname: ${hostname}
|
||||
18
proxmox/templates/machine_config_patches_controlplane.tftpl
Normal file
18
proxmox/templates/machine_config_patches_controlplane.tftpl
Normal file
@@ -0,0 +1,18 @@
|
||||
machine:
|
||||
install:
|
||||
disk: ${install_disk}
|
||||
image: ${install_image}
|
||||
network:
|
||||
hostname: ${hostname}
|
||||
interfaces:
|
||||
- deviceSelector:
|
||||
physical: true
|
||||
addresses:
|
||||
- ${ip_address}
|
||||
routes:
|
||||
- network: ${network}
|
||||
gateway: ${network_gateway}
|
||||
vip:
|
||||
ip: ${vip_shared_ip}
|
||||
cluster:
|
||||
allowSchedulingOnControlPlanes: false
|
||||
14
proxmox/templates/machine_config_patches_worker.tftpl
Normal file
14
proxmox/templates/machine_config_patches_worker.tftpl
Normal file
@@ -0,0 +1,14 @@
|
||||
machine:
|
||||
install:
|
||||
disk: ${install_disk}
|
||||
image: ${install_image}
|
||||
network:
|
||||
hostname: ${hostname}
|
||||
interfaces:
|
||||
- deviceSelector:
|
||||
physical: true
|
||||
addresses:
|
||||
- ${ip_address}
|
||||
routes:
|
||||
- network: ${network}
|
||||
gateway: ${network_gateway}
|
||||
@@ -16,14 +16,37 @@ variable "proxmox_target_node" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "cluster_name" {
|
||||
description = "A name to provide for the Talos cluster"
|
||||
variable "proxmox_storage_device" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "cluster_endpoint" {
|
||||
description = "The endpoint for the Talos cluster"
|
||||
variable "talos_version" {
|
||||
type = string
|
||||
default = "1.11.1"
|
||||
}
|
||||
|
||||
variable "talos_linux_iso_image_url" {
|
||||
description = "URL of the Talos ISO image for initially booting the VM"
|
||||
type = string
|
||||
default = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.11.1/nocloud-amd64.iso"
|
||||
}
|
||||
|
||||
variable "talos_linux_iso_image_filename" {
|
||||
description = "Filename of the Talos ISO image for initially booting the VM"
|
||||
type = string
|
||||
default = "talos-linux-v1.11.1-qemu-guest-agent-amd64.iso"
|
||||
}
|
||||
|
||||
variable "cluster_name" {
|
||||
description = "A name to provide for the Talos cluster"
|
||||
type = string
|
||||
default = "talos"
|
||||
}
|
||||
|
||||
variable "cluster_vip_shared_ip" {
|
||||
description = "Shared virtual IP address for control plane nodes"
|
||||
type = string
|
||||
default = "192.168.1.100"
|
||||
}
|
||||
|
||||
variable "node_data" {
|
||||
@@ -42,20 +65,41 @@ variable "node_data" {
|
||||
})
|
||||
default = {
|
||||
controlplanes = {
|
||||
"192.168.1.150" = {
|
||||
"192.168.1.101" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
}
|
||||
workers = {
|
||||
"192.168.1.151" = {
|
||||
"192.168.1.102" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
|
||||
install_image = "factory.talos.dev/nocloud-installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.11.1"
|
||||
},
|
||||
"192.168.1.152" = {
|
||||
install_disk = "/dev/vda"
|
||||
install_image = "factory.talos.dev/installer/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515:v1.8.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "network" {
|
||||
description = "Network for all nodes"
|
||||
type = string
|
||||
default = "192.168.10.0/24"
|
||||
}
|
||||
|
||||
variable "network_gateway" {
|
||||
description = "Network gateway for all nodes"
|
||||
type = string
|
||||
default = "192.168.10.1"
|
||||
}
|
||||
|
||||
variable "domain_name_server" {
|
||||
description = "DNS for all nodes"
|
||||
type = string
|
||||
default = "192.168.10.1"
|
||||
}
|
||||
|
||||
variable "vlan_tag" {
|
||||
description = "Vlan tag for all nodes, default does not configure a Vlan"
|
||||
type = number
|
||||
default = 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
resource "proxmox_vm_qemu" "kubernetes_control_plane" {
|
||||
depends_on = [proxmox_storage_iso.talos_linux_iso_image]
|
||||
for_each = var.node_data.controlplanes
|
||||
name = format("kubernetes-control-plane-%s", index(keys(var.node_data.controlplanes), each.key))
|
||||
desc = "Kubernetes Control Plane"
|
||||
name = format("%s-kubernetes-control-plane-%s", var.cluster_name, index(keys(var.node_data.controlplanes), each.key))
|
||||
description = "Kubernetes Control Plane"
|
||||
target_node = var.proxmox_target_node
|
||||
agent = 1
|
||||
vm_state = "running"
|
||||
cores = 2
|
||||
memory = 4096
|
||||
memory = 8192
|
||||
boot = "order=virtio0;ide2"
|
||||
|
||||
cpu {
|
||||
cores = 2
|
||||
}
|
||||
|
||||
vga {
|
||||
type = "std"
|
||||
}
|
||||
@@ -17,46 +20,51 @@ resource "proxmox_vm_qemu" "kubernetes_control_plane" {
|
||||
disk {
|
||||
slot = "ide0"
|
||||
type = "cloudinit"
|
||||
storage = "local-lvm"
|
||||
storage = var.proxmox_storage_device
|
||||
}
|
||||
|
||||
disk {
|
||||
slot = "ide2"
|
||||
type = "cdrom"
|
||||
iso = "local:iso/${local.talos_linux_iso_image_filename}"
|
||||
iso = "local:iso/${var.talos_linux_iso_image_filename}"
|
||||
}
|
||||
|
||||
disk {
|
||||
slot = "virtio0"
|
||||
type = "disk"
|
||||
storage = "local-lvm"
|
||||
size = "10240M"
|
||||
storage = var.proxmox_storage_device
|
||||
size = "50G"
|
||||
discard = true
|
||||
}
|
||||
|
||||
network {
|
||||
id = 0
|
||||
model = "virtio"
|
||||
bridge = "vmbr0"
|
||||
tag = var.vlan_tag
|
||||
}
|
||||
|
||||
# Cloud init setup
|
||||
os_type = "cloud-init"
|
||||
ipconfig0 = "ip=${each.key}/24,gw=192.168.1.1"
|
||||
ipconfig0 = "ip=${each.key}/24,gw=${var.network_gateway}"
|
||||
}
|
||||
|
||||
|
||||
resource "proxmox_vm_qemu" "kubernetes_worker" {
|
||||
depends_on = [proxmox_storage_iso.talos_linux_iso_image]
|
||||
for_each = var.node_data.workers
|
||||
name = format("kubernetes-worker-%s", index(keys(var.node_data.workers), each.key))
|
||||
desc = "Kubernetes Worker Node"
|
||||
name = format("%s-kubernetes-worker-%s", var.cluster_name, index(keys(var.node_data.workers), each.key))
|
||||
description = "Kubernetes Worker Node"
|
||||
target_node = var.proxmox_target_node
|
||||
agent = 1
|
||||
vm_state = "running"
|
||||
cores = 2
|
||||
memory = 8192
|
||||
memory = 16384
|
||||
boot = "order=virtio0;ide2"
|
||||
|
||||
cpu {
|
||||
cores = 2
|
||||
}
|
||||
|
||||
vga {
|
||||
type = "std"
|
||||
}
|
||||
@@ -64,29 +72,31 @@ resource "proxmox_vm_qemu" "kubernetes_worker" {
|
||||
disk {
|
||||
slot = "ide0"
|
||||
type = "cloudinit"
|
||||
storage = "local-lvm"
|
||||
storage = var.proxmox_storage_device
|
||||
}
|
||||
|
||||
disk {
|
||||
slot = "ide2"
|
||||
type = "cdrom"
|
||||
iso = "local:iso/${local.talos_linux_iso_image_filename}"
|
||||
iso = "local:iso/${var.talos_linux_iso_image_filename}"
|
||||
}
|
||||
|
||||
disk {
|
||||
slot = "virtio0"
|
||||
type = "disk"
|
||||
storage = "local-lvm"
|
||||
size = "10240M"
|
||||
storage = var.proxmox_storage_device
|
||||
size = "50G"
|
||||
discard = true
|
||||
}
|
||||
|
||||
network {
|
||||
id = 0
|
||||
model = "virtio"
|
||||
bridge = "vmbr0"
|
||||
tag = var.vlan_tag
|
||||
}
|
||||
|
||||
# Cloud init setup
|
||||
os_type = "cloud-init"
|
||||
ipconfig0 = "ip=${each.key}/24,gw=192.168.1.1"
|
||||
ipconfig0 = "ip=${each.key}/24,gw=${var.network_gateway}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user