This commit is contained in:
root
2025-07-30 18:54:27 +00:00
parent e028a916d7
commit b50dcbdf5e
10 changed files with 2833 additions and 42 deletions

View File

@@ -0,0 +1,20 @@
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHHEAlPo3v4U67Y3411pTjIMkQxwlFWdXrBJkSzXenDH flatcar@undercloud"
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: "control-plane1"
systemd:
units:
- name: docker.service
enabled: true

View File

@@ -0,0 +1,20 @@
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHHEAlPo3v4U67Y3411pTjIMkQxwlFWdXrBJkSzXenDH flatcar@undercloud"
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: "control-plane2"
systemd:
units:
- name: docker.service
enabled: true

View File

@@ -0,0 +1,20 @@
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHHEAlPo3v4U67Y3411pTjIMkQxwlFWdXrBJkSzXenDH flatcar@undercloud"
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: "control-plane3"
systemd:
units:
- name: docker.service
enabled: true

3
terraform/fix-ssh.sh Executable file
View File

@@ -0,0 +1,3 @@
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
ssh-add -L

View File

@@ -32,19 +32,89 @@ resource "proxmox_virtual_environment_download_file" "flatcar_image" {
}
# --- Butane zu Ignition ---
data "ct_config" "ignition" {
content = file("${path.module}/flatcar.bu")
data "ct_config" "control_plane1_ignition" {
content = file("${path.module}/control-plane1.bu")
strict = true
pretty_print = true
}
data "ct_config" "control_plane2_ignition" {
content = file("${path.module}/control-plane2.bu")
strict = true
pretty_print = true
}
data "ct_config" "control_plane3_ignition" {
content = file("${path.module}/control-plane3.bu")
strict = true
pretty_print = true
}
data "ct_config" "worker1_ignition" {
content = file("${path.module}/worker1.bu")
strict = true
pretty_print = true
}
data "ct_config" "worker2_ignition" {
content = file("${path.module}/worker2.bu")
strict = true
pretty_print = true
}
data "ct_config" "worker3_ignition" {
content = file("${path.module}/worker3.bu")
strict = true
pretty_print = true
}
resource "proxmox_virtual_environment_file" "flatcar_ignition" {
resource "proxmox_virtual_environment_file" "control_plane1_ignition" {
content_type = "snippets"
datastore_id = "cephfs" # dein Storage
node_name = "hyper1" # oder einer deiner Cluster-Nodes
source_raw {
data = data.ct_config.ignition.rendered
file_name = "flatcar-ignition-user-data"
data = data.ct_config.control_plane1_ignition.rendered
file_name = "control-plane1-ignition-user-data"
}
}
resource "proxmox_virtual_environment_file" "control_plane2_ignition" {
content_type = "snippets"
datastore_id = "cephfs" # dein Storage
node_name = "hyper1" # oder einer deiner Cluster-Nodes
source_raw {
data = data.ct_config.control_plane2_ignition.rendered
file_name = "control-plane2-ignition-user-data"
}
}
resource "proxmox_virtual_environment_file" "control_plane3_ignition" {
content_type = "snippets"
datastore_id = "cephfs" # dein Storage
node_name = "hyper1" # oder einer deiner Cluster-Nodes
source_raw {
data = data.ct_config.control_plane3_ignition.rendered
file_name = "control-plane3-ignition-user-data"
}
}
resource "proxmox_virtual_environment_file" "worker1_ignition" {
content_type = "snippets"
datastore_id = "cephfs" # dein Storage
node_name = "hyper1" # oder einer deiner Cluster-Nodes
source_raw {
data = data.ct_config.worker1_ignition.rendered
file_name = "worker1-ignition-user-data"
}
}
resource "proxmox_virtual_environment_file" "worker2_ignition" {
content_type = "snippets"
datastore_id = "cephfs" # dein Storage
node_name = "hyper1" # oder einer deiner Cluster-Nodes
source_raw {
data = data.ct_config.worker2_ignition.rendered
file_name = "worker2-ignition-user-data"
}
}
resource "proxmox_virtual_environment_file" "worker3_ignition" {
content_type = "snippets"
datastore_id = "cephfs" # dein Storage
node_name = "hyper1" # oder einer deiner Cluster-Nodes
source_raw {
data = data.ct_config.worker3_ignition.rendered
file_name = "worker3-ignition-user-data"
}
}
@@ -63,6 +133,7 @@ resource "proxmox_virtual_environment_vm" "flatcar_template" {
memory {
dedicated = 2048
floating = 2048
}
network_device {
@@ -91,14 +162,14 @@ resource "proxmox_virtual_environment_vm" "flatcar_template" {
ignore_changes = [boot_order]
}
tags = ["template-build"]
tags = ["flatcar","kubernetes","terraform"]
}
# --- VM anlegen ---
resource "proxmox_virtual_environment_vm" "flatcar" {
name = "flatcar-simple"
node_name = "hyper2"
description = "Flatcar VM mit Ignition"
# --- control planes anlegen ---
resource "proxmox_virtual_environment_vm" "control_plane1" {
name = "control-plane1"
node_name = "hyper1"
description = "kubernetes control-plane1"
# Hardware
cpu {
@@ -106,6 +177,7 @@ resource "proxmox_virtual_environment_vm" "flatcar" {
}
memory {
dedicated = 2048
floating = 2048
}
# Netzwerk
@@ -123,8 +195,178 @@ resource "proxmox_virtual_environment_vm" "flatcar" {
# Ignition-Config
initialization {
user_data_file_id = "${proxmox_virtual_environment_file.flatcar_ignition.id}"
user_data_file_id = "${proxmox_virtual_environment_file.control_plane1_ignition.id}"
}
tags = ["control-plane","flatcar","kubernetes","terraform"]
depends_on = [proxmox_virtual_environment_file.control_plane1_ignition]
}
resource "proxmox_virtual_environment_vm" "control_plane2" {
name = "control-plane2"
node_name = "hyper2"
description = "kubernetes control-plane2"
# Hardware
cpu {
cores = 2
}
memory {
dedicated = 2048
floating = 2048
}
depends_on = [proxmox_virtual_environment_file.flatcar_ignition]
# Netzwerk
network_device {
bridge = "vmbr0"
model = "virtio"
}
# Disk (Template klonen oder QCOW2 angeben)
clone {
vm_id = proxmox_virtual_environment_vm.flatcar_template.id
full = true
node_name = "hyper1"
}
# Ignition-Config
initialization {
user_data_file_id = "${proxmox_virtual_environment_file.control_plane2_ignition.id}"
}
tags = ["control-plane","flatcar","kubernetes","terraform"]
depends_on = [proxmox_virtual_environment_file.control_plane2_ignition]
}
resource "proxmox_virtual_environment_vm" "control_plane3" {
name = "control-plane3"
node_name = "hyper3"
description = "kubernetes control-plane3"
# Hardware
cpu {
cores = 2
}
memory {
dedicated = 2048
floating = 2048
}
# Netzwerk
network_device {
bridge = "vmbr0"
model = "virtio"
}
# Disk (Template klonen oder QCOW2 angeben)
clone {
vm_id = proxmox_virtual_environment_vm.flatcar_template.id
full = true
node_name = "hyper1"
}
# Ignition-Config
initialization {
user_data_file_id = "${proxmox_virtual_environment_file.control_plane3_ignition.id}"
}
tags = ["control-plane","flatcar","kubernetes","terraform"]
depends_on = [proxmox_virtual_environment_file.control_plane3_ignition]
}
resource "proxmox_virtual_environment_vm" "worker1" {
name = "worker1"
node_name = "hyper1"
description = "kubernetes worker1"
# Hardware
cpu {
cores = 2
}
memory {
dedicated = 8192
floating = 8192
}
# Netzwerk
network_device {
bridge = "vmbr0"
model = "virtio"
}
# Disk (Template klonen oder QCOW2 angeben)
clone {
vm_id = proxmox_virtual_environment_vm.flatcar_template.id
full = true
node_name = "hyper1"
}
# Ignition-Config
initialization {
user_data_file_id = "${proxmox_virtual_environment_file.worker1_ignition.id}"
}
tags = ["worker","flatcar","kubernetes","terraform"]
depends_on = [proxmox_virtual_environment_file.worker1_ignition]
}
resource "proxmox_virtual_environment_vm" "worker2" {
name = "worker2"
node_name = "hyper2"
description = "kubernetes worker2"
# Hardware
cpu {
cores = 2
}
memory {
dedicated = 8192
floating = 8192
}
# Netzwerk
network_device {
bridge = "vmbr0"
model = "virtio"
}
# Disk (Template klonen oder QCOW2 angeben)
clone {
vm_id = proxmox_virtual_environment_vm.flatcar_template.id
full = true
node_name = "hyper1"
}
# Ignition-Config
initialization {
user_data_file_id = "${proxmox_virtual_environment_file.worker2_ignition.id}"
}
tags = ["worker","flatcar","kubernetes","terraform"]
depends_on = [proxmox_virtual_environment_file.worker2_ignition]
}
resource "proxmox_virtual_environment_vm" "worker3" {
name = "worker3"
node_name = "hyper3"
description = "kubernetes worker3"
# Hardware
cpu {
cores = 2
}
memory {
dedicated = 8192
floating = 8192
}
# Netzwerk
network_device {
bridge = "vmbr0"
model = "virtio"
}
# Disk (Template klonen oder QCOW2 angeben)
clone {
vm_id = proxmox_virtual_environment_vm.flatcar_template.id
full = true
node_name = "hyper1"
}
# Ignition-Config
initialization {
user_data_file_id = "${proxmox_virtual_environment_file.worker3_ignition.id}"
}
tags = ["worker","flatcar","kubernetes","terraform"]
depends_on = [proxmox_virtual_environment_file.worker3_ignition]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

20
terraform/worker1.bu Normal file
View File

@@ -0,0 +1,20 @@
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHHEAlPo3v4U67Y3411pTjIMkQxwlFWdXrBJkSzXenDH flatcar@undercloud"
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: "worker1"
systemd:
units:
- name: docker.service
enabled: true

20
terraform/worker2.bu Normal file
View File

@@ -0,0 +1,20 @@
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHHEAlPo3v4U67Y3411pTjIMkQxwlFWdXrBJkSzXenDH flatcar@undercloud"
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: "worker2"
systemd:
units:
- name: docker.service
enabled: true

20
terraform/worker3.bu Normal file
View File

@@ -0,0 +1,20 @@
variant: flatcar
version: 1.1.0
passwd:
users:
- name: core
ssh_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHHEAlPo3v4U67Y3411pTjIMkQxwlFWdXrBJkSzXenDH flatcar@undercloud"
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
inline: "worker3"
systemd:
units:
- name: docker.service
enabled: true