diff --git a/init.tf b/init.tf index 39b2c47..c09b428 100644 --- a/init.tf +++ b/init.tf @@ -94,7 +94,7 @@ resource "null_resource" "kustomization" { content = local.is_single_node_cluster ? "" : templatefile( "${path.module}/templates/traefik_config.yaml.tpl", { - cluster_pet_name = random_pet.cluster.id + name = "k3s-${random_pet.cluster.id}-traefik" load_balancer_disable_ipv6 = var.load_balancer_disable_ipv6 load_balancer_type = var.load_balancer_type location = var.location diff --git a/main.tf b/main.tf index fa0da53..2c14ef7 100644 --- a/main.tf +++ b/main.tf @@ -51,7 +51,7 @@ resource "hcloud_placement_group" "k3s" { data "hcloud_load_balancer" "traefik" { count = local.is_single_node_cluster ? 0 : 1 - name = "traefik-${random_pet.cluster.id}" + name = "k3s-${random_pet.cluster.id}-traefik" depends_on = [null_resource.kustomization] } diff --git a/templates/traefik_config.yaml.tpl b/templates/traefik_config.yaml.tpl index e78d957..35f6037 100644 --- a/templates/traefik_config.yaml.tpl +++ b/templates/traefik_config.yaml.tpl @@ -9,7 +9,7 @@ spec: enabled: true type: LoadBalancer annotations: - "load-balancer.hetzner.cloud/name": "traefik-${cluster_pet_name}" + "load-balancer.hetzner.cloud/name": name # make hetzners load-balancer connect to our nodes via our private k3s "load-balancer.hetzner.cloud/use-private-ip": "true" # keep hetzner-ccm from exposing our private ingress ip, which in general isn't routeable from the public internet