Skip to content

Commit 111b120

Browse files
committed
azure: Add enable_ipv6_load_balancing variable and default false
* Azure Load Balancers include 5 rules (3 LB rules, 2 outbound) whether used or not * [#1468](#1468) added 3 LB rules to support IPv6 load balancing, raising the rules count from 5 to 8 and added ~$21/mo to the cost of the load balancer. If you use an edge (e.g. Cloudflare) a cluster does not need to load balance IPv6, so this additional cost can be avoided * I noticed this because my load balancing costs were up for the last few months. The gotcha is that outbound rules count toward the 5 rules included with the base cost of the LB (~$18/mo) Docs: https://azure.microsoft.com/en-us/pricing/details/load-balancer/
1 parent 1955b23 commit 111b120

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Notable changes between versions.
1616
* Remove `network_mtu`, `network_encapsulation`, and `network_ip_autodetection_method` variables (Calico-specific)
1717
* Remove Calico-specific Kubelet mounts
1818

19+
### Azure
20+
21+
* Add `enable_ipv6_load_balancing` variable and change the default to false (**breaking**)
22+
* Azure Load Balancers include 5 rules (3 LB rules, 2 outbound) whether used or not
23+
* [#1468](https://github.com/poseidon/typhoon/pull/1468) added 3 LB rules to support IPv6 load balancing,
24+
raising the rules count from 5 to 8 and added ~$21/mo to the cost of the load balancer
1925

2026
### Fedora CoreOS
2127

azure/fedora-coreos/kubernetes/lb.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ resource "azurerm_dns_aaaa_record" "apiserver" {
1818
# DNS record
1919
name = var.cluster_name
2020
ttl = 300
21-
# IPv4 address of apiserver load balancer
21+
# IPv6 address of apiserver load balancer
2222
records = [azurerm_public_ip.frontend-ipv6.ip_address]
2323
}
2424

@@ -74,6 +74,8 @@ resource "azurerm_lb_rule" "apiserver-ipv4" {
7474
}
7575

7676
resource "azurerm_lb_rule" "apiserver-ipv6" {
77+
count = var.enable_ipv6_load_balancing ? 1 : 0
78+
7779
name = "apiserver-ipv6"
7880
loadbalancer_id = azurerm_lb.cluster.id
7981
frontend_ip_configuration_name = "frontend-ipv6"
@@ -113,6 +115,8 @@ resource "azurerm_lb_rule" "ingress-https-ipv4" {
113115
}
114116

115117
resource "azurerm_lb_rule" "ingress-http-ipv6" {
118+
count = var.enable_ipv6_load_balancing ? 1 : 0
119+
116120
name = "ingress-http-ipv6"
117121
loadbalancer_id = azurerm_lb.cluster.id
118122
frontend_ip_configuration_name = "frontend-ipv6"
@@ -126,6 +130,8 @@ resource "azurerm_lb_rule" "ingress-http-ipv6" {
126130
}
127131

128132
resource "azurerm_lb_rule" "ingress-https-ipv6" {
133+
count = var.enable_ipv6_load_balancing ? 1 : 0
134+
129135
name = "ingress-https-ipv6"
130136
loadbalancer_id = azurerm_lb.cluster.id
131137
frontend_ip_configuration_name = "frontend-ipv6"
@@ -140,7 +146,7 @@ resource "azurerm_lb_rule" "ingress-https-ipv6" {
140146

141147
# Backend Address Pools
142148

143-
# Address pool of controllers
149+
# Address pools for controllers
144150
resource "azurerm_lb_backend_address_pool" "controller-ipv4" {
145151
name = "controller-ipv4"
146152
loadbalancer_id = azurerm_lb.cluster.id
@@ -151,7 +157,7 @@ resource "azurerm_lb_backend_address_pool" "controller-ipv6" {
151157
loadbalancer_id = azurerm_lb.cluster.id
152158
}
153159

154-
# Address pool of workers
160+
# Address pools for workers
155161
resource "azurerm_lb_backend_address_pool" "worker-ipv4" {
156162
name = "worker-ipv4"
157163
loadbalancer_id = azurerm_lb.cluster.id

azure/fedora-coreos/kubernetes/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ EOD
144144
default = "10.3.0.0/16"
145145
}
146146

147+
variable "enable_ipv6_load_balancing" {
148+
description = "Enable IPv6 LB rules (note: Azure charges ~$20/mo more)"
149+
default = false
150+
}
151+
147152
variable "worker_node_labels" {
148153
type = list(string)
149154
description = "List of initial worker node labels"

azure/flatcar-linux/kubernetes/lb.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ resource "azurerm_lb_rule" "apiserver-ipv4" {
7474
}
7575

7676
resource "azurerm_lb_rule" "apiserver-ipv6" {
77+
count = var.enable_ipv6_load_balancing ? 1 : 0
78+
7779
name = "apiserver-ipv6"
7880
loadbalancer_id = azurerm_lb.cluster.id
7981
frontend_ip_configuration_name = "frontend-ipv6"
@@ -113,6 +115,8 @@ resource "azurerm_lb_rule" "ingress-https-ipv4" {
113115
}
114116

115117
resource "azurerm_lb_rule" "ingress-http-ipv6" {
118+
count = var.enable_ipv6_load_balancing ? 1 : 0
119+
116120
name = "ingress-http-ipv6"
117121
loadbalancer_id = azurerm_lb.cluster.id
118122
frontend_ip_configuration_name = "frontend-ipv6"
@@ -126,6 +130,8 @@ resource "azurerm_lb_rule" "ingress-http-ipv6" {
126130
}
127131

128132
resource "azurerm_lb_rule" "ingress-https-ipv6" {
133+
count = var.enable_ipv6_load_balancing ? 1 : 0
134+
129135
name = "ingress-https-ipv6"
130136
loadbalancer_id = azurerm_lb.cluster.id
131137
frontend_ip_configuration_name = "frontend-ipv6"
@@ -140,7 +146,7 @@ resource "azurerm_lb_rule" "ingress-https-ipv6" {
140146

141147
# Backend Address Pools
142148

143-
# Address pool of controllers
149+
# Address pools for controllers
144150
resource "azurerm_lb_backend_address_pool" "controller-ipv4" {
145151
name = "controller-ipv4"
146152
loadbalancer_id = azurerm_lb.cluster.id

azure/flatcar-linux/kubernetes/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ EOD
150150
default = "10.3.0.0/16"
151151
}
152152

153+
variable "enable_ipv6_load_balancing" {
154+
description = "Enable IPv6 LB rules (note: Azure charges ~$20/mo more)"
155+
default = false
156+
}
157+
153158
variable "worker_node_labels" {
154159
type = list(string)
155160
description = "List of initial worker node labels"

0 commit comments

Comments
 (0)