Changes: - Use LB private IP (10.0.1.5) instead of public IP for cluster joins - Add LB private IP to k3s TLS SANs on primary control plane - This allows secondary CPs and workers to verify certificates when joining via LB Fixes x509 certificate validation error when joining via LB public IP.
71 lines
2.0 KiB
HCL
71 lines
2.0 KiB
HCL
output "control_plane_ips" {
|
|
description = "Public IPs of control plane nodes"
|
|
value = [for cp in hcloud_server.control_plane : cp.ipv4_address]
|
|
}
|
|
|
|
output "control_plane_names" {
|
|
description = "Control plane hostnames"
|
|
value = [for cp in hcloud_server.control_plane : cp.name]
|
|
}
|
|
|
|
output "control_plane_private_ips" {
|
|
description = "Private IPs of control plane nodes"
|
|
value = [
|
|
for idx, cp in hcloud_server.control_plane :
|
|
try(one(cp.network).ip, cidrhost(var.subnet_cidr, 10 + idx))
|
|
]
|
|
}
|
|
|
|
output "primary_control_plane_ip" {
|
|
description = "Public IP of the primary control plane (first node)"
|
|
value = hcloud_server.control_plane[0].ipv4_address
|
|
}
|
|
|
|
output "worker_ips" {
|
|
description = "Public IPs of worker nodes"
|
|
value = [for worker in hcloud_server.workers : worker.ipv4_address]
|
|
}
|
|
|
|
output "worker_names" {
|
|
description = "Worker hostnames"
|
|
value = [for worker in hcloud_server.workers : worker.name]
|
|
}
|
|
|
|
output "worker_private_ips" {
|
|
description = "Private IPs of worker nodes"
|
|
value = [
|
|
for idx, worker in hcloud_server.workers :
|
|
try(one(worker.network).ip, cidrhost(var.subnet_cidr, 20 + idx))
|
|
]
|
|
}
|
|
|
|
output "ssh_private_key_path" {
|
|
description = "Path to SSH private key"
|
|
value = var.ssh_private_key
|
|
}
|
|
|
|
output "cluster_name" {
|
|
description = "Cluster name"
|
|
value = var.cluster_name
|
|
}
|
|
|
|
output "tailscale_tailnet" {
|
|
description = "Tailnet domain suffix"
|
|
value = var.tailscale_tailnet
|
|
}
|
|
|
|
output "network_cidr" {
|
|
description = "Private network CIDR"
|
|
value = var.subnet_cidr
|
|
}
|
|
|
|
output "kubeconfig_command" {
|
|
description = "Command to fetch kubeconfig"
|
|
value = "ssh root@${hcloud_server.control_plane[0].ipv4_address} 'cat /etc/rancher/k3s/k3s.yaml' > kubeconfig && sed -i 's/127.0.0.1/${hcloud_server.control_plane[0].ipv4_address}/g' kubeconfig"
|
|
}
|
|
|
|
output "kube_api_lb_ip" {
|
|
description = "Load Balancer private IP for Kubernetes API (used for cluster joins)"
|
|
value = hcloud_load_balancer_network.kube_api.ip
|
|
}
|