feat: Add HA Kubernetes cluster with Terraform + Ansible
- 3x CX23 control plane nodes (HA) - 4x CX33 worker nodes - k3s with embedded etcd - Hetzner CCM for load balancers - Gitea CI/CD workflows - Backblaze B2 for Terraform state
This commit is contained in:
44
terraform/outputs.tf
Normal file
44
terraform/outputs.tf
Normal file
@@ -0,0 +1,44 @@
|
||||
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_private_ips" {
|
||||
description = "Private IPs of control plane nodes"
|
||||
value = [for cp in hcloud_server.control_plane : cp.network[0].ip]
|
||||
}
|
||||
|
||||
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_private_ips" {
|
||||
description = "Private IPs of worker nodes"
|
||||
value = [for worker in hcloud_server.workers : worker.network[0].ip]
|
||||
}
|
||||
|
||||
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 "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"
|
||||
}
|
||||
Reference in New Issue
Block a user