Updated talos version, made setup more configurable, removed obsolet stuff
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".
|
# This file is maintained automatically by "tofu init".
|
||||||
# Manual edits may be lost in future updates.
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
provider "registry.opentofu.org/opentofu/local" {
|
provider "registry.opentofu.org/hashicorp/local" {
|
||||||
version = "2.5.1"
|
version = "2.5.3"
|
||||||
constraints = "2.5.1"
|
constraints = "2.5.3"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:87L+rpGao062xifb1VuG9YVFwp9vbDP6G2fgfYxUkQs=",
|
"h1:31Clmfoe7hzkcdgwuhUuGuPGfeG2Ksk+YWcJgzBTN7M=",
|
||||||
"zh:031c2c2070672b7e78e0aa15560839278dc57fe7cf1e58a617ac13c67b31d5fb",
|
"zh:32e1d4b0595cea6cda4ca256195c162772ddff25594ab4008731a2ec7be230bf",
|
||||||
"zh:1ef64ea4f8382cd538a76f3d319f405d18130dc3280f1c16d6aaa52a188ecaa4",
|
"zh:48c390af0c87df994ec9796f04ec2582bcac581fb81ed6bb58e0671da1c17991",
|
||||||
"zh:422ce45691b2f384dbd4596fdc8209d95cb43d85a82aaa0173089d38976d6e96",
|
"zh:4be7289c969218a57b40902e2f359914f8d35a7f97b439140cb711aa21e494bd",
|
||||||
"zh:7415fbd8da72d9363ba55dd8115837714f9534f5a9a518ec42268c2da1b9ed2f",
|
"zh:4cf958e631e99ed6c8b522c9b22e1f1b568c0bdadb01dd002ca7dffb1c927764",
|
||||||
"zh:92aa22d071339c8ef595f18a9f9245c287266c80689f5746b26e10eaed04d542",
|
"zh:7a0132c0faca4c4c96aa70808effd6817e28712bf5a39881666ac377b4250acf",
|
||||||
"zh:9cd0d99f5d3be835d6336c19c4057af6274e193e677ecf6370e5b0de12b4aafe",
|
"zh:7d60de08fac427fb045e4590d1b921b6778498eee9eb16f78c64d4c577bde096",
|
||||||
"zh:a8c1525b389be5809a97f02aa7126e491ba518f97f57ed3095a3992f2134bb8f",
|
"zh:91003bee5981e99ec3925ce2f452a5f743827f9d0e131a86613549c1464796f0",
|
||||||
"zh:b336fa75f72643154b07c09b3968e417a41293358a54fe03efc0db715c5451e6",
|
"zh:9fe2fe75977c8149e2515fb30c6cc6cfd57b225d4ce592c570d81a3831d7ffa3",
|
||||||
"zh:c66529133599a419123ad2e42874afbd9aba82bd1de2b15cc68d2a1e665d4c8e",
|
"zh:e210e6be54933ce93e03d0994e520ba289aa01b2c1f70e77afb8f2ee796b0fe3",
|
||||||
"zh:c7568f75ba6cb7c3660b69eaab8b0e4278533bd9a7a4c33ee6590cc7e69743ea",
|
"zh:e8793e5f9422f2b31a804e51806595f335b827c9a38db18766960464566f21d5",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.opentofu.org/siderolabs/talos" {
|
provider "registry.opentofu.org/siderolabs/talos" {
|
||||||
version = "0.7.0-alpha.0"
|
version = "0.9.0"
|
||||||
constraints = "0.7.0-alpha.0"
|
constraints = "0.9.0"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:RMoURrHNTK/4ofsYr803w/GZIk/W4BtkR9tPcHeqkzw=",
|
"h1:50TaymX/KnjXcURmpKsVd7JUyLRrMDNXMHFgqzSe88U=",
|
||||||
"zh:090d86eee971ac84a1d6999d1ccdb1323f257ced6aec068ac39f621d9410baad",
|
|
||||||
"zh:0fa82a384b25a58b65523e0ea4768fa1212b1f5cfc0c9379d31162454fedcc9d",
|
"zh:0fa82a384b25a58b65523e0ea4768fa1212b1f5cfc0c9379d31162454fedcc9d",
|
||||||
"zh:3de44dd80dee28b4e5840886167b2a0abab16dd8aefa1d387f913e57723bf74a",
|
"zh:249ab08b810bb96ef7c35354a12622907df7cbda59c83ff314ee85e8b851128d",
|
||||||
"zh:3eb60ee11290e32cb436aa6c2801fe16f436388ee3578f913656776590634835",
|
"zh:4f284c21f0cb4b7012fdb231ebba4803e5c389f7ea380fb5958ebfa6b822d055",
|
||||||
"zh:5d31feb8a7782a5f77cfd7e4447f731d9f69c9350a1cf08ec98b66bd014bbb2a",
|
"zh:6049f8d06bc92ab1a46d56c2b37799e6a1b7ce3c61905acf8f0c2009942be8ac",
|
||||||
"zh:6b0c1d0965fd256ac38911add83a95a179d69843978956c5a2980c073f209b8d",
|
"zh:7de5f0a6429c6856ade3c7e59d5041a7fe8e0010aea14a2074e91f8a526283ce",
|
||||||
"zh:75431c28ac8a09243291e95d9ce93ae250bc77e1e40c81e94b84639dfca3e492",
|
"zh:9760420cf5feec0550556664962bc6f1af45115b9ea5bcbf47aa9bffd3dd4ac2",
|
||||||
"zh:7f26210ddc7af32737756ce214b208218a2c1679475e3eb49504543911e7d9ad",
|
"zh:9860272a9fbcea65393c478dc579ad2677a44338de24677702ce699a027801aa",
|
||||||
"zh:8e5b685a8db6ddb28db84df076729389a3fb8cbe0576f996ab7e0a0a31220b4e",
|
"zh:a60311a8bf267b18dcf1c8250f45e371b51c6aef086e037a3f9496602f190187",
|
||||||
"zh:b441337a78d2fbcea9cf0261ddc45599dd332459700e87484f1258d656399f6a",
|
"zh:b74c119b2a964cae8d17b5b5f14c8eecf44708e3817c1f65ac89b813856aed98",
|
||||||
"zh:bbb54c313bf26845b012d3d74f4d300cea96dbb2d7410e7210e64cb0be2d1f60",
|
"zh:bc33e14650052c246ac2e6492a0a24755d4e8d27cb7259e3996f07b0537f2c77",
|
||||||
"zh:c7991f7c27762ba17404ee6b666e7b66c6cd8bf24f01103c0d2ed96a40021b5e",
|
"zh:c4bc2c65b3dcef2508c14dbbfc18937c5ede11670c02a644cbc28c83a57de92b",
|
||||||
"zh:d8901ba224dc14f4d6cab1509a4d2f7bd87958fa3d7840c70f59fa2967f77515",
|
"zh:c98bf4809220568d76ea2db232a88a60c29fd90d4c9e2f8c8a68cf91ceed066a",
|
||||||
"zh:dc425e059399527f44e493cc8a078244065b4c0f5a77bbd9f00f3b47fb4a27d3",
|
"zh:de0179ee9c55bf36d3474049ceac3a105ed7bc1fb9c4787d4076c4b15d268b66",
|
||||||
"zh:de3b15a809b49ef9fee77f9f864c2ed1bdbfa62fc258c59473169269f354d8f5",
|
"zh:e99e019d950131c2c4259c1cbca1d072cb813bdfdbbbf9359f5901d6b7542a0d",
|
||||||
|
"zh:feb941cc673692c6858f96590f3ca082683a62aa2d2842b9bfffcd327eb840d3",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "registry.opentofu.org/telmate/proxmox" {
|
provider "registry.opentofu.org/telmate/proxmox" {
|
||||||
version = "3.0.1-rc4"
|
version = "3.0.2-rc04"
|
||||||
constraints = "3.0.1-rc4"
|
constraints = "3.0.2-rc04"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:tcfqcTB5TDQKSGrWksACZdFIX6ig72i++OYaC8EncOU=",
|
"h1:ZPr93UUVOw1aCqsODLXsqNQ9Lq/WafX5jgCCLxKBHl4=",
|
||||||
"zh:1070aff02aebeadf130368b0082e76d976f61464b3bb29c1c5a7866bb14c7380",
|
"zh:00586a3e02061734f5ff4c309696ec1bbd6e00a7ed1281c44626f02929417f6e",
|
||||||
"zh:3cd96c232a12cf3bbb0e874508e5ff14116ef347d60db20db17ad87bb161ee22",
|
"zh:05af12aababd0a67a95309a803123f3c238b16ecdb73dc59c8d9c3d4a0b691c5",
|
||||||
"zh:4f75954f3e68159ed969e3eac27485166103058eff3f99186d805816c6f8eb66",
|
"zh:4b6457bd0138f5c66c8b7043bdbffe3b8abcce2383293d77f653dbd77d14428f",
|
||||||
"zh:55572fd22f7c62813a691fe0d017b2a57a34f3b4e1c40af6c2197731878ebf84",
|
"zh:7b1b6e76d6b03c7829b8dadeb30de236782be314f5146d9f29ee12bd01961d7a",
|
||||||
"zh:6536402b2eff0a754ff975c39318c3c0b47dfa2dc4461d34a8c55ba493288d9f",
|
"zh:87c21e0a8244b73c62ad3221773ec1c72fb918e0025b0664183a8ad8bebeb5bc",
|
||||||
"zh:735f4283286cb78fe28b4ad001771c460f1963ee640e027467eb199d80a6c257",
|
"zh:954997c550285dfc167977683b97b045dd62923c251fad32c4ca81b564c2005f",
|
||||||
"zh:90a675455c5812d90acbf44bfee347c2318b13565c68bcf64b452dbe6c2a629a",
|
"zh:98781ef0199877580256e9f9a7f0666107f76af23f54f67d6392a66a6f5001b5",
|
||||||
"zh:9bbfe89d3f0997a26d7636d5c2d7244beccf92371d17073583299b1b74e1ab9c",
|
"zh:9fc4dbd1752e2b9125223be2dd25597c0e6d534aa784c4829af3c3e3e58eb973",
|
||||||
"zh:9ed8ecb50c4ed8555ffe1544325de07db678e2877f7c4637fbfaf02d5f004100",
|
"zh:a3f672019aee2d45c202668b95c48113e3c50001b740bd48956738ad1418c6b7",
|
||||||
"zh:b1e362ebd234aa82a38ffcfa4e74295e8a23811edff8af88f79372ba18ef0918",
|
"zh:a539852a4034132442e6dc6f644444994d83b0dc7a4d30bbe6464de420cfdf2d",
|
||||||
"zh:c652faede363a91ad3a148cdd1b3d9c3ab8bac1b94d92ce89eb6e1ddadc99cc1",
|
"zh:aade0b50a559a1da683c49ec8527e5e66b12ed42d4b1f10e69b25cbbf6c67805",
|
||||||
"zh:d803958e5e465095cc0d5741abf0abd80b5fd3d1c076b40880a136e737bb06d0",
|
"zh:bdb7c2b78cfe039247948fa75fad49f871f8a8bb9b969aec4c45a24edc80ab0f",
|
||||||
"zh:fa12bd372e39c8ac6295503f88884f328971834e109fcc015322fc9ab5fe858f",
|
"zh:c16209a6748f87a379a5a3132ca4f471a4807bd478664499593e09433ba39b7b",
|
||||||
"zh:fb7abe461d36f9868a0a6728320e482ecd54e047c2876dce85d5c2143eba3b8f",
|
"zh:cb015fb4a0a50d151c35c6a3505cdf7a337edd0b65eba82a43c8142c523adfb8",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
|
# Proxmox
|
||||||
proxmox_api_url = "https://192.168.1.10:8006/api2/json"
|
proxmox_api_url = "https://192.168.1.10:8006/api2/json"
|
||||||
proxmox_api_token_id = "root@pam!supersecret"
|
proxmox_api_token_id = "root@pam!supersecret"
|
||||||
proxmox_api_token_secret = "js7ej5k9-hd75-hd64-js56-js834jmd732"
|
proxmox_api_token_secret = "js7ej5k9-hd75-hd64-js56-js834jmd732"
|
||||||
proxmox_target_node = "your proxmox node"
|
proxmox_target_node = "your proxmox node"
|
||||||
|
proxmox_storage_device = "samsung-ssd"
|
||||||
|
|
||||||
|
# Talos Linux
|
||||||
cluster_name = "your cluster name"
|
cluster_name = "your cluster name"
|
||||||
cluster_endpoint = "https://192.168.1.100:6443"
|
network = "192.168.1.0/24"
|
||||||
|
network_gateway = "192.168.1.1"
|
||||||
|
domain_name_server = "192.168.1.1"
|
||||||
|
vlan_tag = 20 # Optional: if you don't specify it no Vlan tag is set for the virtual machine
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
cluster:
|
|
||||||
allowSchedulingOnControlPlanes: true
|
|
||||||
@@ -1,17 +1,5 @@
|
|||||||
locals {
|
locals {
|
||||||
repo_root = "${dirname(abspath(path.root))}"
|
|
||||||
|
|
||||||
# Talos Linux
|
# Talos Linux
|
||||||
talos_linux_iso_image_url = "https://factory.talos.dev/image/ce4c980550dd2ab1b17bbf2b08801c7eb59418eafe8f279833297925d67c7515/v1.8.2/nocloud-amd64.iso"
|
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.8.2-qemu-guest-agent-amd64.iso"
|
talos_linux_iso_image_filename = "talos-linux-v1.11.1-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,22 +1,22 @@
|
|||||||
terraform {
|
terraform {
|
||||||
required_providers {
|
required_providers {
|
||||||
local = {
|
local = {
|
||||||
source = "opentofu/local"
|
source = "hashicorp/local"
|
||||||
version = "2.5.1"
|
version = "2.5.3"
|
||||||
}
|
}
|
||||||
proxmox = {
|
proxmox = {
|
||||||
source = "telmate/proxmox"
|
source = "telmate/proxmox"
|
||||||
version = "3.0.1-rc4"
|
version = "3.0.2-rc04"
|
||||||
}
|
}
|
||||||
talos = {
|
talos = {
|
||||||
source = "siderolabs/talos"
|
source = "siderolabs/talos"
|
||||||
version = "0.7.0-alpha.0"
|
version = "0.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "proxmox" {
|
provider "proxmox" {
|
||||||
pm_api_url= var.proxmox_api_url
|
pm_api_url = var.proxmox_api_url
|
||||||
pm_api_token_id = var.proxmox_api_token_id
|
pm_api_token_id = var.proxmox_api_token_id
|
||||||
pm_api_token_secret = var.proxmox_api_token_secret
|
pm_api_token_secret = var.proxmox_api_token_secret
|
||||||
pm_tls_insecure = true
|
pm_tls_insecure = true
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ resource "talos_machine_secrets" "this" {}
|
|||||||
|
|
||||||
data "talos_machine_configuration" "controlplane" {
|
data "talos_machine_configuration" "controlplane" {
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
cluster_endpoint = var.cluster_endpoint
|
cluster_endpoint = "https://${var.vip_shared_ip}:6443"
|
||||||
machine_type = "controlplane"
|
machine_type = "controlplane"
|
||||||
machine_secrets = talos_machine_secrets.this.machine_secrets
|
machine_secrets = talos_machine_secrets.this.machine_secrets
|
||||||
}
|
}
|
||||||
|
|
||||||
data "talos_machine_configuration" "worker" {
|
data "talos_machine_configuration" "worker" {
|
||||||
cluster_name = var.cluster_name
|
cluster_name = var.cluster_name
|
||||||
cluster_endpoint = var.cluster_endpoint
|
cluster_endpoint = "https://${var.vip_shared_ip}:6443"
|
||||||
machine_type = "worker"
|
machine_type = "worker"
|
||||||
machine_secrets = talos_machine_secrets.this.machine_secrets
|
machine_secrets = talos_machine_secrets.this.machine_secrets
|
||||||
}
|
}
|
||||||
@@ -27,12 +27,15 @@ resource "talos_machine_configuration_apply" "controlplane" {
|
|||||||
for_each = var.node_data.controlplanes
|
for_each = var.node_data.controlplanes
|
||||||
node = each.key
|
node = each.key
|
||||||
config_patches = [
|
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
|
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_disk = each.value.install_disk
|
||||||
install_image = each.value.install_image
|
install_image = each.value.install_image
|
||||||
|
ip_address = "${each.key}/24"
|
||||||
|
network = var.network
|
||||||
|
network_gateway = var.network_gateway
|
||||||
|
vip_shared_ip = var.vip_shared_ip
|
||||||
}),
|
}),
|
||||||
file("${path.module}/files/cp-scheduling.yaml"),
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,10 +46,13 @@ resource "talos_machine_configuration_apply" "worker" {
|
|||||||
for_each = var.node_data.workers
|
for_each = var.node_data.workers
|
||||||
node = each.key
|
node = each.key
|
||||||
config_patches = [
|
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
|
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_disk = each.value.install_disk
|
||||||
install_image = each.value.install_image
|
install_image = each.value.install_image
|
||||||
|
ip_address = "${each.key}/24"
|
||||||
|
network = var.network
|
||||||
|
network_gateway = var.network_gateway
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
machine:
|
|
||||||
install:
|
|
||||||
disk: ${install_disk}
|
|
||||||
image: ${install_image}
|
|
||||||
network:
|
|
||||||
hostname: ${hostname}
|
|
||||||
33
proxmox/templates/machine_config_patches_controlplane.tftpl
Normal file
33
proxmox/templates/machine_config_patches_controlplane.tftpl
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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}
|
||||||
|
registries:
|
||||||
|
mirrors:
|
||||||
|
docker.io:
|
||||||
|
endpoints:
|
||||||
|
- https://harbor.lan/v2/docker-hub-cache
|
||||||
|
overridePath: true
|
||||||
|
ghcr.io:
|
||||||
|
endpoints:
|
||||||
|
- https://harbor.lan/v2/github-cache
|
||||||
|
overridePath: true
|
||||||
|
config:
|
||||||
|
harbor.lan:
|
||||||
|
tls:
|
||||||
|
ca: |
|
||||||
|
${indent(16, container_registry_cache_ca)}
|
||||||
|
cluster:
|
||||||
|
allowSchedulingOnControlPlanes: false
|
||||||
29
proxmox/templates/machine_config_patches_worker.tftpl
Normal file
29
proxmox/templates/machine_config_patches_worker.tftpl
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
machine:
|
||||||
|
install:
|
||||||
|
disk: ${install_disk}
|
||||||
|
image: ${install_image}
|
||||||
|
network:
|
||||||
|
hostname: ${hostname}
|
||||||
|
interfaces:
|
||||||
|
- deviceSelector:
|
||||||
|
physical: true
|
||||||
|
addresses:
|
||||||
|
- ${ip_address}
|
||||||
|
routes:
|
||||||
|
- network: ${network}
|
||||||
|
gateway: ${network_gateway}
|
||||||
|
registries:
|
||||||
|
mirrors:
|
||||||
|
docker.io:
|
||||||
|
endpoints:
|
||||||
|
- https://harbor.lan/v2/docker-hub-cache
|
||||||
|
overridePath: true
|
||||||
|
ghcr.io:
|
||||||
|
endpoints:
|
||||||
|
- https://harbor.lan/v2/github-cache
|
||||||
|
overridePath: true
|
||||||
|
config:
|
||||||
|
harbor.lan:
|
||||||
|
tls:
|
||||||
|
ca: |
|
||||||
|
${indent(16, container_registry_cache_ca)}
|
||||||
@@ -16,13 +16,12 @@ variable "proxmox_target_node" {
|
|||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_name" {
|
variable "proxmox_storage_device" {
|
||||||
description = "A name to provide for the Talos cluster"
|
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cluster_endpoint" {
|
variable "cluster_name" {
|
||||||
description = "The endpoint for the Talos cluster"
|
description = "A name to provide for the Talos cluster"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,18 +43,46 @@ variable "node_data" {
|
|||||||
controlplanes = {
|
controlplanes = {
|
||||||
"192.168.1.150" = {
|
"192.168.1.150" = {
|
||||||
install_disk = "/dev/vda"
|
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 = {
|
workers = {
|
||||||
"192.168.1.151" = {
|
"192.168.1.151" = {
|
||||||
install_disk = "/dev/vda"
|
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" = {
|
"192.168.1.152" = {
|
||||||
install_disk = "/dev/vda"
|
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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "network" {
|
||||||
|
description = "Network for all nodes"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "network_gateway" {
|
||||||
|
description = "Network gateway for all nodes"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "domain_name_server" {
|
||||||
|
description = "DNS for all nodes"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vip_shared_ip" {
|
||||||
|
description = "Shared virtual IP address for control plane nodes"
|
||||||
|
type = string
|
||||||
|
default = "192.168.20.10"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vlan_tag" {
|
||||||
|
description = "Vlan tag for all nodes, default does not configure a Vlan"
|
||||||
|
type = number
|
||||||
|
default = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,17 @@ 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("kubernetes-control-plane-%s", index(keys(var.node_data.controlplanes), each.key))
|
||||||
desc = "Kubernetes Control Plane"
|
description = "Kubernetes Control Plane"
|
||||||
target_node = var.proxmox_target_node
|
target_node = var.proxmox_target_node
|
||||||
agent = 1
|
agent = 1
|
||||||
vm_state = "running"
|
vm_state = "running"
|
||||||
cores = 2
|
memory = 8192
|
||||||
memory = 4096
|
|
||||||
boot = "order=virtio0;ide2"
|
boot = "order=virtio0;ide2"
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
cores = 2
|
||||||
|
}
|
||||||
|
|
||||||
vga {
|
vga {
|
||||||
type = "std"
|
type = "std"
|
||||||
}
|
}
|
||||||
@@ -17,7 +20,7 @@ resource "proxmox_vm_qemu" "kubernetes_control_plane" {
|
|||||||
disk {
|
disk {
|
||||||
slot = "ide0"
|
slot = "ide0"
|
||||||
type = "cloudinit"
|
type = "cloudinit"
|
||||||
storage = "local-lvm"
|
storage = var.proxmox_storage_device
|
||||||
}
|
}
|
||||||
|
|
||||||
disk {
|
disk {
|
||||||
@@ -29,7 +32,7 @@ resource "proxmox_vm_qemu" "kubernetes_control_plane" {
|
|||||||
disk {
|
disk {
|
||||||
slot = "virtio0"
|
slot = "virtio0"
|
||||||
type = "disk"
|
type = "disk"
|
||||||
storage = "local-lvm"
|
storage = var.proxmox_storage_device
|
||||||
size = "10240M"
|
size = "10240M"
|
||||||
discard = true
|
discard = true
|
||||||
}
|
}
|
||||||
@@ -37,11 +40,12 @@ resource "proxmox_vm_qemu" "kubernetes_control_plane" {
|
|||||||
network {
|
network {
|
||||||
model = "virtio"
|
model = "virtio"
|
||||||
bridge = "vmbr0"
|
bridge = "vmbr0"
|
||||||
|
tag = var.vlan_tag
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cloud init setup
|
# Cloud init setup
|
||||||
os_type = "cloud-init"
|
os_type = "cloud-init"
|
||||||
ipconfig0 = "ip=${each.key}/24,gw=192.168.1.1"
|
ipconfig0 = "ip=${each.key}/24,gw=${var.network_gateway}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -49,14 +53,17 @@ 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("kubernetes-worker-%s", index(keys(var.node_data.workers), each.key))
|
||||||
desc = "Kubernetes Worker Node"
|
description = "Kubernetes Worker Node"
|
||||||
target_node = var.proxmox_target_node
|
target_node = var.proxmox_target_node
|
||||||
agent = 1
|
agent = 1
|
||||||
vm_state = "running"
|
vm_state = "running"
|
||||||
cores = 2
|
memory = 16384
|
||||||
memory = 8192
|
|
||||||
boot = "order=virtio0;ide2"
|
boot = "order=virtio0;ide2"
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
cores = 2
|
||||||
|
}
|
||||||
|
|
||||||
vga {
|
vga {
|
||||||
type = "std"
|
type = "std"
|
||||||
}
|
}
|
||||||
@@ -64,7 +71,7 @@ resource "proxmox_vm_qemu" "kubernetes_worker" {
|
|||||||
disk {
|
disk {
|
||||||
slot = "ide0"
|
slot = "ide0"
|
||||||
type = "cloudinit"
|
type = "cloudinit"
|
||||||
storage = "local-lvm"
|
storage = var.proxmox_storage_device
|
||||||
}
|
}
|
||||||
|
|
||||||
disk {
|
disk {
|
||||||
@@ -76,7 +83,7 @@ resource "proxmox_vm_qemu" "kubernetes_worker" {
|
|||||||
disk {
|
disk {
|
||||||
slot = "virtio0"
|
slot = "virtio0"
|
||||||
type = "disk"
|
type = "disk"
|
||||||
storage = "local-lvm"
|
storage = var.proxmox_storage_device
|
||||||
size = "10240M"
|
size = "10240M"
|
||||||
discard = true
|
discard = true
|
||||||
}
|
}
|
||||||
@@ -84,9 +91,10 @@ resource "proxmox_vm_qemu" "kubernetes_worker" {
|
|||||||
network {
|
network {
|
||||||
model = "virtio"
|
model = "virtio"
|
||||||
bridge = "vmbr0"
|
bridge = "vmbr0"
|
||||||
|
tag = var.vlan_tag
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cloud init setup
|
# Cloud init setup
|
||||||
os_type = "cloud-init"
|
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