chore: update to K8s 1.31

This commit is contained in:
Peter 2025-02-06 14:19:36 +01:00
parent efe16ccb89
commit de76be5138
Signed by: prskr
GPG key ID: F56BED6903BC5E37
4 changed files with 18 additions and 67 deletions

View file

@ -47,7 +47,7 @@ systemd:
Environment="K3S_URL=https://172.23.2.10:6443"
Environment="K3S_TOKEN=${k3s_token}"
Environment="INSTALL_K3S_VERSION=${k3s_version}"
Environment="INSTALL_K3S_EXEC=agent --node-ip=${node_ip} --kubelet-arg --cloud-provider=external --node-label k8s.icb4dc0.de/storage-node=${tostring(storage_node)}"
Environment="INSTALL_K3S_EXEC=agent --node-ip=${node_ip} --kubelet-arg --cloud-provider=external"
ExecStart=/usr/bin/sh -c "/opt/k3s-install.sh"
[Install]
WantedBy=multi-user.target
@ -62,12 +62,3 @@ storage:
mode: 0777
contents:
source: https://get.k3s.io
- path: /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
mode: 0644
contents:
inline: |
{{- template "base" . }}
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "io.containerd.spin.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin.options]
BinaryName = "/opt/bin/containerd-shim-spin-v2"

View file

@ -126,20 +126,6 @@ resource "hcloud_server" "machine" {
}
resource "null_resource" "machine-drainable" {
for_each = var.k3s_workers
lifecycle {
replace_triggered_by = [hcloud_server.machine[each.key]]
}
provisioner "local-exec" {
when = destroy
on_failure = continue
command = "kubectl drain --delete-emptydir-data=true --ignore-daemonsets=true --disable-eviction ${each.key}"
}
}
data "ct_config" "machine-ignitions" {
for_each = var.k3s_workers
strict = true
@ -150,7 +136,6 @@ data "ct_config" "machine-ignitions" {
"k3s_token" = var.k3s_token
"node_ip" = each.value.private_ip
"k3s_version" = var.worker_k3s_version
"storage_node" = each.value.storage_node
"spin_shim_version" = var.spin_shim_version
"arch" = startswith(each.value.server_type, "cax") ? "aarch64" : "x86_64"
}

18
vars.tf
View file

@ -44,31 +44,18 @@ variable "spin_shim_version" {
variable "control_plane_k3s_version" {
type = string
default = "v1.30.5+k3s1"
default = "v1.31.5+k3s1"
}
variable "worker_k3s_version" {
type = string
default = "v1.30.5+k3s1"
default = "v1.31.5+k3s1"
}
variable "k3s_sans" {
type = list(string)
}
variable "garage_storage" {
description = "Config of Garage storage"
type = object({
size = number
location = string
})
default = {
size = 20
location = "hel1"
}
}
variable "k3s_control_plane" {
type = map(object({
server_type = string
@ -85,7 +72,6 @@ variable "k3s_workers" {
generation = number
private_ip = string
location = string
storage_node = bool
}))
}

View file

@ -15,36 +15,25 @@ k3s_sans = [
]
k3s_workers = {
"w1-cx22-hel1" = {
server_type = "cx22"
generation = 11
private_ip = "172.23.2.20"
location = "hel1"
storage_node = false
"w1-cax11-hel1-gen3" = {
server_type = "cax21"
generation = 1
private_ip = "172.23.2.20"
location = "hel1"
}
"w2-cax11-hel1" = {
server_type = "cax21"
generation = 1
private_ip = "172.23.2.21"
location = "hel1"
storage_node = true
"w2-cax11-hel1-gen3" = {
server_type = "cax21"
generation = 1
private_ip = "172.23.2.21"
location = "hel1"
}
"w3-cax11-hel1" = {
server_type = "cax21"
generation = 1
private_ip = "172.23.2.22"
location = "hel1"
storage_node = true
}
"w4-cax11-hel1" = {
server_type = "cax21"
generation = 1
private_ip = "172.23.2.23"
location = "hel1"
storage_node = true
"w3-cax11-hel1-gen3" = {
server_type = "cax21"
generation = 1
private_ip = "172.23.2.22"
location = "hel1"
}
}