Talos on Proxmox WIP
This commit is contained in:
+5
-3
@@ -1,4 +1,6 @@
|
||||
data "proxmox_vm" "ch01" {
|
||||
id = 100
|
||||
node_name = "hv01"
|
||||
data "proxmox_virtual_environment_nodes" "hvc01" {}
|
||||
|
||||
data "proxmox_virtual_environment_node" "hvc01" {
|
||||
for_each = toset(data.proxmox_virtual_environment_nodes.hvc01.names)
|
||||
node_name = each.value
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# resource "proxmox_virtual_environment_file" "cloud_init_user_data" {
|
||||
# for_each = toset(var.vm_guests)
|
||||
# content_type = "snippets"
|
||||
# datastore_id = "local"
|
||||
# file_mode = 0666
|
||||
# node_name = each.value.host
|
||||
# overwrite = true
|
||||
# source_raw {
|
||||
# data = templatefile()
|
||||
# file_name = "cloud_init_user_data_${each.value.name}.yml"
|
||||
# }
|
||||
# timeout_upload = 10
|
||||
# upload_mode = "stream"
|
||||
# }
|
||||
|
||||
resource "proxmox_virtual_environment_file" "talos_iso" {
|
||||
for_each = data.proxmox_virtual_environment_node.hvc01
|
||||
content_type = "iso"
|
||||
datastore_id = "local"
|
||||
node_name = each.value.id
|
||||
overwrite = false
|
||||
source_file {
|
||||
# checksum =
|
||||
file_name = "talos_${local.talos_version}.iso"
|
||||
insecure = false
|
||||
min_tls = "1.2"
|
||||
path = data.talos_image_factory_urls.this.urls.iso_secureboot
|
||||
}
|
||||
timeout_upload = 120
|
||||
# upload_mode = # N/A, has no effect when content_type = iso
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
customization:
|
||||
systemExtensions:
|
||||
officialExtensions:
|
||||
- siderolabs/amd-ucode
|
||||
- siderolabs/amdgpu
|
||||
- siderolabs/i915
|
||||
- siderolabs/intel-ucode
|
||||
- siderolabs/lldpd
|
||||
- siderolabs/nfs-utils
|
||||
- siderolabs/nfsd
|
||||
- siderolabs/nfsrahead
|
||||
- siderolabs/nut-client
|
||||
- siderolabs/nvme-cli
|
||||
- siderolabs/qemu-guest-agent
|
||||
- siderolabs/xe
|
||||
bootloader: sd-boot
|
||||
@@ -0,0 +1,5 @@
|
||||
locals {
|
||||
hv01_id = [ for node in data.proxmox_virtual_environment_node.hvc01 : node if node.node_name == "hv01"][0].id
|
||||
# Validate talos_version variable
|
||||
talos_version = [ for version in data.talos_image_factory_versions.this.talos_versions : version if version == var.talos_version][0]
|
||||
}
|
||||
+13
-4
@@ -1,6 +1,15 @@
|
||||
output "ch01" {
|
||||
description = "Container Host 01 VM details"
|
||||
value = {
|
||||
status = data.proxmox_vm.ch01.status
|
||||
# output "ch01" {
|
||||
# description = "Container Host 01 VM details"
|
||||
# value = {
|
||||
# status = data.proxmox_vm.ch01.status
|
||||
# }
|
||||
# }
|
||||
|
||||
output "talos_schematic_id" {
|
||||
value = talos_image_factory_schematic.this.id
|
||||
}
|
||||
|
||||
output "debug" {
|
||||
description = "For debugging resource or data key values"
|
||||
value = data.talos_image_factory_urls.this.urls
|
||||
}
|
||||
Binary file not shown.
@@ -5,4 +5,20 @@ provider "proxmox" {
|
||||
random_vm_ids = true
|
||||
random_vm_id_start = 10000
|
||||
random_vm_id_end = 99999
|
||||
ssh {
|
||||
username = "ladmin"
|
||||
agent = true
|
||||
node_address_source = "dns"
|
||||
node {
|
||||
name = "hv01"
|
||||
address = "hv01.balsillie.house"
|
||||
port = 22
|
||||
}
|
||||
node {
|
||||
name = "hv02"
|
||||
address = "hv02.balsillie.house"
|
||||
port = 22
|
||||
}
|
||||
}
|
||||
}
|
||||
provider "talos" {}
|
||||
@@ -0,0 +1,2 @@
|
||||
talos_version = "v1.13.9"
|
||||
cluster_endpoint = "https://k8s01.balsillie.house:6443"
|
||||
@@ -0,0 +1,19 @@
|
||||
resource "talos_machine_secrets" "this" {
|
||||
talos_version = local.talos_version
|
||||
}
|
||||
|
||||
resource "talos_image_factory_schematic" "this" {
|
||||
schematic = file("${path.root}/files/talos_image_schematic.yml")
|
||||
}
|
||||
|
||||
data "talos_image_factory_versions" "this" {
|
||||
filters = {
|
||||
stable_versions_only = true
|
||||
}
|
||||
}
|
||||
|
||||
data "talos_image_factory_urls" "this" {
|
||||
talos_version = local.talos_version
|
||||
schematic_id = talos_image_factory_schematic.this.id
|
||||
platform = "nocloud"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
cluster:
|
||||
id: <CLUSTER_ID>
|
||||
secret: <CLUSTER_SECRET>
|
||||
token: <BOOTSTRAP_TOKEN>
|
||||
endpoint: https://<LOAD_BALANCER_IP>:6443
|
||||
|
||||
machine:
|
||||
type: controlplane
|
||||
token: <JOIN_TOKEN>
|
||||
kubelet:
|
||||
image: ghcr.io/siderolabs/kubelet:v1.29.0
|
||||
install:
|
||||
disk: /dev/sda
|
||||
image: ghcr.io/siderolabs/installer:v1.6.0
|
||||
bootLOADER: grub
|
||||
network:
|
||||
interfaces:
|
||||
- interface: eth0
|
||||
dhcp: true
|
||||
nameservers:
|
||||
- 8.8.8.8
|
||||
sysctls:
|
||||
fs.inotify.max_user_watches: "1048576"
|
||||
features:
|
||||
rbac: true
|
||||
stableHostname: true
|
||||
appArmor: true
|
||||
@@ -6,6 +6,10 @@ terraform {
|
||||
source = "registry.terraform.io/bpg/proxmox"
|
||||
version = ">= 0.111.1"
|
||||
}
|
||||
talos = {
|
||||
source = "registry.terraform.io/siderolabs/talos"
|
||||
version = "0.11.0"
|
||||
}
|
||||
}
|
||||
|
||||
backend "local" {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
variable "vm_guests" {
|
||||
type = list(object({
|
||||
name = string
|
||||
host = string
|
||||
ipv4_address = string
|
||||
role = string
|
||||
cpu = number
|
||||
memory = number
|
||||
}))
|
||||
}
|
||||
|
||||
variable "talos_version" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "cluster_endpoint" {
|
||||
type = string
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
vm_guests = [
|
||||
{
|
||||
cpu = 1
|
||||
host = "hv01"
|
||||
ipv4_address = "10.96.10.61"
|
||||
memory = 4096
|
||||
name = "k8s01-cp01"
|
||||
role = "talos_control_plane"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user