This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlb_kubernetes.tf
55 lines (52 loc) · 1.68 KB
/
lb_kubernetes.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
// Definitions for the main load-balancer that targets our kubernetes cluster
resource "hcloud_load_balancer" "kubernetes" {
name = "kubernetes"
load_balancer_type = "lb11"
delete_protection = var.enable_delete_protection
}
resource "hcloud_load_balancer_target" "kubernetes-backend-srv" {
type = "ip"
load_balancer_id = hcloud_load_balancer.kubernetes.id
ip = data.dns_a_record_set.backend_server.addrs[0]
}
resource "hcloud_load_balancer_target" "kubernetes-live-srv" {
type = "ip"
load_balancer_id = hcloud_load_balancer.kubernetes.id
ip = data.dns_a_record_set.live_server.addrs[0]
}
resource "hcloud_load_balancer_target" "kubernetes-production-srv" {
type = "ip"
load_balancer_id = hcloud_load_balancer.kubernetes.id
ip = data.dns_a_record_set.production_server.addrs[0]
}
resource "hcloud_load_balancer_service" "kubernetes-ingress-http" {
load_balancer_id = hcloud_load_balancer.kubernetes.id
protocol = "tcp"
listen_port = 80
destination_port = 30080
proxyprotocol = true
health_check {
protocol = "tcp"
port = 30080
interval = 15
timeout = 5
retries = 3
}
}
resource "hcloud_load_balancer_service" "kubernetes-ingress-https" {
load_balancer_id = hcloud_load_balancer.kubernetes.id
protocol = "tcp"
listen_port = 443
destination_port = 30443
proxyprotocol = true
health_check {
protocol = "tcp"
port = 30443
interval = 15
timeout = 5
retries = 3
}
}
output "kubernetes_load_balancer" {
value = "${hcloud_load_balancer.kubernetes.ipv4} & ${hcloud_load_balancer.kubernetes.ipv6}"
}