-
Notifications
You must be signed in to change notification settings - Fork 12
/
ha_load_balancer.tf
61 lines (47 loc) · 1.17 KB
/
ha_load_balancer.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# A dual-stack cluster with a highly-available control plane using a
# Hetzner Cloud load balancer.
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "~> 1.38"
}
}
}
variable "hetzner_token" {}
provider "hcloud" {
token = var.hetzner_token
}
resource "hcloud_ssh_key" "key" {
name = "key"
public_key = file("~/.ssh/id_rsa.pub")
}
module "cluster" {
source = "tibordp/dualstack-k8s/hcloud"
name = "k8s"
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = var.hetzner_token
location = "nbg1"
server_type = "cpx31"
node_count = 3
control_plane_endpoint = "k8s.example.com"
}
module "workers" {
source = "tibordp/dualstack-k8s/hcloud//modules/worker-node"
cluster = module.cluster
count = 3
name = "k8s-worker-${count.index}"
hcloud_ssh_key = hcloud_ssh_key.key.id
location = "nbg1"
server_type = "cpx31"
}
output "load_balancer_ipv4" {
value = module.cluster.load_balancer.ipv4
}
output "load_balancer_ipv6" {
value = module.cluster.load_balancer.ipv6
}
output "kubeconfig" {
value = module.cluster.kubeconfig
sensitive = true
}