Allow upgrading Azure Terraform Provider to v3.x
* Change subnet references to source and destinations prefixes (plural) * Remove references to a resource group in some load balancing components, which no longer require it (inferred) * Rename `worker_address_prefix` output to `worker_address_prefixes`
This commit is contained in:
parent
5365ce8204
commit
93ebfc7dd0
|
@ -4,6 +4,11 @@ Notable changes between versions.
|
||||||
|
|
||||||
## Latest
|
## Latest
|
||||||
|
|
||||||
|
### Azure
|
||||||
|
|
||||||
|
* Allow upgrading Azure Terraform provider to v3.x ([#1144](https://github.com/poseidon/typhoon/pull/1144))
|
||||||
|
* Rename `worker_address_prefix` output to `worker_address_prefixes`
|
||||||
|
|
||||||
## v1.23.5
|
## v1.23.5
|
||||||
|
|
||||||
* Kubernetes [v1.23.5](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md#v1235)
|
* Kubernetes [v1.23.5](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md#v1235)
|
||||||
|
|
|
@ -53,8 +53,6 @@ resource "azurerm_lb" "cluster" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "apiserver" {
|
resource "azurerm_lb_rule" "apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "apiserver"
|
name = "apiserver"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration_name = "apiserver"
|
frontend_ip_configuration_name = "apiserver"
|
||||||
|
@ -67,8 +65,6 @@ resource "azurerm_lb_rule" "apiserver" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "ingress-http" {
|
resource "azurerm_lb_rule" "ingress-http" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "ingress-http"
|
name = "ingress-http"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration_name = "ingress"
|
frontend_ip_configuration_name = "ingress"
|
||||||
|
@ -82,8 +78,6 @@ resource "azurerm_lb_rule" "ingress-http" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "ingress-https" {
|
resource "azurerm_lb_rule" "ingress-https" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "ingress-https"
|
name = "ingress-https"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration_name = "ingress"
|
frontend_ip_configuration_name = "ingress"
|
||||||
|
@ -98,8 +92,6 @@ resource "azurerm_lb_rule" "ingress-https" {
|
||||||
|
|
||||||
# Worker outbound TCP/UDP SNAT
|
# Worker outbound TCP/UDP SNAT
|
||||||
resource "azurerm_lb_outbound_rule" "worker-outbound" {
|
resource "azurerm_lb_outbound_rule" "worker-outbound" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "worker"
|
name = "worker"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration {
|
frontend_ip_configuration {
|
||||||
|
@ -126,8 +118,6 @@ resource "azurerm_lb_backend_address_pool" "worker" {
|
||||||
|
|
||||||
# TCP health check for apiserver
|
# TCP health check for apiserver
|
||||||
resource "azurerm_lb_probe" "apiserver" {
|
resource "azurerm_lb_probe" "apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "apiserver"
|
name = "apiserver"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
|
@ -141,8 +131,6 @@ resource "azurerm_lb_probe" "apiserver" {
|
||||||
|
|
||||||
# HTTP health check for ingress
|
# HTTP health check for ingress
|
||||||
resource "azurerm_lb_probe" "ingress" {
|
resource "azurerm_lb_probe" "ingress" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "ingress"
|
name = "ingress"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
protocol = "Http"
|
protocol = "Http"
|
||||||
|
|
|
@ -41,4 +41,3 @@ resource "azurerm_subnet_network_security_group_association" "worker" {
|
||||||
subnet_id = azurerm_subnet.worker.id
|
subnet_id = azurerm_subnet.worker.id
|
||||||
network_security_group_id = azurerm_network_security_group.worker.id
|
network_security_group_id = azurerm_network_security_group.worker.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ output "worker_security_group_name" {
|
||||||
value = azurerm_network_security_group.worker.name
|
value = azurerm_network_security_group.worker.name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "worker_address_prefix" {
|
output "worker_address_prefixes" {
|
||||||
description = "Worker network subnet CIDR address (for source/destination)"
|
description = "Worker network subnet CIDR addresses (for source/destination)"
|
||||||
value = azurerm_subnet.worker.address_prefix
|
value = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for custom load balancing
|
# Outputs for custom load balancing
|
||||||
|
|
|
@ -10,171 +10,171 @@ resource "azurerm_network_security_group" "controller" {
|
||||||
resource "azurerm_network_security_rule" "controller-icmp" {
|
resource "azurerm_network_security_rule" "controller-icmp" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-icmp"
|
name = "allow-icmp"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "1995"
|
priority = "1995"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Icmp"
|
protocol = "Icmp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "*"
|
destination_port_range = "*"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-ssh" {
|
resource "azurerm_network_security_rule" "controller-ssh" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-ssh"
|
name = "allow-ssh"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2000"
|
priority = "2000"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "22"
|
destination_port_range = "22"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-etcd" {
|
resource "azurerm_network_security_rule" "controller-etcd" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-etcd"
|
name = "allow-etcd"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2005"
|
priority = "2005"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "2379-2380"
|
destination_port_range = "2379-2380"
|
||||||
source_address_prefix = azurerm_subnet.controller.address_prefix
|
source_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape etcd metrics
|
# Allow Prometheus to scrape etcd metrics
|
||||||
resource "azurerm_network_security_rule" "controller-etcd-metrics" {
|
resource "azurerm_network_security_rule" "controller-etcd-metrics" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-etcd-metrics"
|
name = "allow-etcd-metrics"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2010"
|
priority = "2010"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "2381"
|
destination_port_range = "2381"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape kube-proxy metrics
|
# Allow Prometheus to scrape kube-proxy metrics
|
||||||
resource "azurerm_network_security_rule" "controller-kube-proxy" {
|
resource "azurerm_network_security_rule" "controller-kube-proxy" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-kube-proxy-metrics"
|
name = "allow-kube-proxy-metrics"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2011"
|
priority = "2011"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "10249"
|
destination_port_range = "10249"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape kube-scheduler and kube-controller-manager metrics
|
# Allow Prometheus to scrape kube-scheduler and kube-controller-manager metrics
|
||||||
resource "azurerm_network_security_rule" "controller-kube-metrics" {
|
resource "azurerm_network_security_rule" "controller-kube-metrics" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-kube-metrics"
|
name = "allow-kube-metrics"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2012"
|
priority = "2012"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "10257-10259"
|
destination_port_range = "10257-10259"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-apiserver" {
|
resource "azurerm_network_security_rule" "controller-apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-apiserver"
|
name = "allow-apiserver"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2015"
|
priority = "2015"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "6443"
|
destination_port_range = "6443"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-cilium-health" {
|
resource "azurerm_network_security_rule" "controller-cilium-health" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
count = var.networking == "cilium" ? 1 : 0
|
count = var.networking == "cilium" ? 1 : 0
|
||||||
|
|
||||||
name = "allow-cilium-health"
|
name = "allow-cilium-health"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2019"
|
priority = "2019"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4240"
|
destination_port_range = "4240"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-vxlan" {
|
resource "azurerm_network_security_rule" "controller-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-vxlan"
|
name = "allow-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2020"
|
priority = "2020"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4789"
|
destination_port_range = "4789"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-linux-vxlan" {
|
resource "azurerm_network_security_rule" "controller-linux-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-linux-vxlan"
|
name = "allow-linux-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2021"
|
priority = "2021"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "8472"
|
destination_port_range = "8472"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape node-exporter daemonset
|
# Allow Prometheus to scrape node-exporter daemonset
|
||||||
resource "azurerm_network_security_rule" "controller-node-exporter" {
|
resource "azurerm_network_security_rule" "controller-node-exporter" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-node-exporter"
|
name = "allow-node-exporter"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2025"
|
priority = "2025"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "9100"
|
destination_port_range = "9100"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow apiserver to access kubelet's for exec, log, port-forward
|
# Allow apiserver to access kubelet's for exec, log, port-forward
|
||||||
|
@ -191,8 +191,8 @@ resource "azurerm_network_security_rule" "controller-kubelet" {
|
||||||
destination_port_range = "10250"
|
destination_port_range = "10250"
|
||||||
|
|
||||||
# allow Prometheus to scrape kubelet metrics too
|
# allow Prometheus to scrape kubelet metrics too
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
||||||
|
@ -240,139 +240,139 @@ resource "azurerm_network_security_group" "worker" {
|
||||||
resource "azurerm_network_security_rule" "worker-icmp" {
|
resource "azurerm_network_security_rule" "worker-icmp" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-icmp"
|
name = "allow-icmp"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "1995"
|
priority = "1995"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Icmp"
|
protocol = "Icmp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "*"
|
destination_port_range = "*"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-ssh" {
|
resource "azurerm_network_security_rule" "worker-ssh" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-ssh"
|
name = "allow-ssh"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2000"
|
priority = "2000"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "22"
|
destination_port_range = "22"
|
||||||
source_address_prefix = azurerm_subnet.controller.address_prefix
|
source_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-http" {
|
resource "azurerm_network_security_rule" "worker-http" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-http"
|
name = "allow-http"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2005"
|
priority = "2005"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "80"
|
destination_port_range = "80"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-https" {
|
resource "azurerm_network_security_rule" "worker-https" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-https"
|
name = "allow-https"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2010"
|
priority = "2010"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "443"
|
destination_port_range = "443"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-cilium-health" {
|
resource "azurerm_network_security_rule" "worker-cilium-health" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
count = var.networking == "cilium" ? 1 : 0
|
count = var.networking == "cilium" ? 1 : 0
|
||||||
|
|
||||||
name = "allow-cilium-health"
|
name = "allow-cilium-health"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2014"
|
priority = "2014"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4240"
|
destination_port_range = "4240"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-vxlan" {
|
resource "azurerm_network_security_rule" "worker-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-vxlan"
|
name = "allow-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2015"
|
priority = "2015"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4789"
|
destination_port_range = "4789"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-linux-vxlan" {
|
resource "azurerm_network_security_rule" "worker-linux-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-linux-vxlan"
|
name = "allow-linux-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2016"
|
priority = "2016"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "8472"
|
destination_port_range = "8472"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape node-exporter daemonset
|
# Allow Prometheus to scrape node-exporter daemonset
|
||||||
resource "azurerm_network_security_rule" "worker-node-exporter" {
|
resource "azurerm_network_security_rule" "worker-node-exporter" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-node-exporter"
|
name = "allow-node-exporter"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2020"
|
priority = "2020"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "9100"
|
destination_port_range = "9100"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape kube-proxy
|
# Allow Prometheus to scrape kube-proxy
|
||||||
resource "azurerm_network_security_rule" "worker-kube-proxy" {
|
resource "azurerm_network_security_rule" "worker-kube-proxy" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-kube-proxy"
|
name = "allow-kube-proxy"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2024"
|
priority = "2024"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "10249"
|
destination_port_range = "10249"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow apiserver to access kubelet's for exec, log, port-forward
|
# Allow apiserver to access kubelet's for exec, log, port-forward
|
||||||
|
@ -389,8 +389,8 @@ resource "azurerm_network_security_rule" "worker-kubelet" {
|
||||||
destination_port_range = "10250"
|
destination_port_range = "10250"
|
||||||
|
|
||||||
# allow Prometheus to scrape kubelet metrics too
|
# allow Prometheus to scrape kubelet metrics too
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_version = ">= 0.13.0, < 2.0.0"
|
required_version = ">= 0.13.0, < 2.0.0"
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = "~> 2.8"
|
azurerm = ">= 2.8, < 4.0"
|
||||||
template = "~> 2.2"
|
template = "~> 2.2"
|
||||||
null = ">= 2.1"
|
null = ">= 2.1"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_version = ">= 0.13.0, < 2.0.0"
|
required_version = ">= 0.13.0, < 2.0.0"
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = "~> 2.8"
|
azurerm = ">= 2.8, < 4.0"
|
||||||
template = "~> 2.2"
|
template = "~> 2.2"
|
||||||
|
|
||||||
ct = {
|
ct = {
|
||||||
|
|
|
@ -53,8 +53,6 @@ resource "azurerm_lb" "cluster" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "apiserver" {
|
resource "azurerm_lb_rule" "apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "apiserver"
|
name = "apiserver"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration_name = "apiserver"
|
frontend_ip_configuration_name = "apiserver"
|
||||||
|
@ -67,8 +65,6 @@ resource "azurerm_lb_rule" "apiserver" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "ingress-http" {
|
resource "azurerm_lb_rule" "ingress-http" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "ingress-http"
|
name = "ingress-http"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration_name = "ingress"
|
frontend_ip_configuration_name = "ingress"
|
||||||
|
@ -82,8 +78,6 @@ resource "azurerm_lb_rule" "ingress-http" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_lb_rule" "ingress-https" {
|
resource "azurerm_lb_rule" "ingress-https" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "ingress-https"
|
name = "ingress-https"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration_name = "ingress"
|
frontend_ip_configuration_name = "ingress"
|
||||||
|
@ -98,8 +92,6 @@ resource "azurerm_lb_rule" "ingress-https" {
|
||||||
|
|
||||||
# Worker outbound TCP/UDP SNAT
|
# Worker outbound TCP/UDP SNAT
|
||||||
resource "azurerm_lb_outbound_rule" "worker-outbound" {
|
resource "azurerm_lb_outbound_rule" "worker-outbound" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "worker"
|
name = "worker"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
frontend_ip_configuration {
|
frontend_ip_configuration {
|
||||||
|
@ -126,8 +118,6 @@ resource "azurerm_lb_backend_address_pool" "worker" {
|
||||||
|
|
||||||
# TCP health check for apiserver
|
# TCP health check for apiserver
|
||||||
resource "azurerm_lb_probe" "apiserver" {
|
resource "azurerm_lb_probe" "apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "apiserver"
|
name = "apiserver"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
|
@ -141,8 +131,6 @@ resource "azurerm_lb_probe" "apiserver" {
|
||||||
|
|
||||||
# HTTP health check for ingress
|
# HTTP health check for ingress
|
||||||
resource "azurerm_lb_probe" "ingress" {
|
resource "azurerm_lb_probe" "ingress" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
|
||||||
|
|
||||||
name = "ingress"
|
name = "ingress"
|
||||||
loadbalancer_id = azurerm_lb.cluster.id
|
loadbalancer_id = azurerm_lb.cluster.id
|
||||||
protocol = "Http"
|
protocol = "Http"
|
||||||
|
|
|
@ -41,4 +41,3 @@ resource "azurerm_subnet_network_security_group_association" "worker" {
|
||||||
subnet_id = azurerm_subnet.worker.id
|
subnet_id = azurerm_subnet.worker.id
|
||||||
network_security_group_id = azurerm_network_security_group.worker.id
|
network_security_group_id = azurerm_network_security_group.worker.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ output "worker_security_group_name" {
|
||||||
value = azurerm_network_security_group.worker.name
|
value = azurerm_network_security_group.worker.name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "worker_address_prefix" {
|
output "worker_address_prefixes" {
|
||||||
description = "Worker network subnet CIDR address (for source/destination)"
|
description = "Worker network subnet CIDR addresses (for source/destination)"
|
||||||
value = azurerm_subnet.worker.address_prefix
|
value = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Outputs for custom load balancing
|
# Outputs for custom load balancing
|
||||||
|
|
|
@ -10,171 +10,171 @@ resource "azurerm_network_security_group" "controller" {
|
||||||
resource "azurerm_network_security_rule" "controller-icmp" {
|
resource "azurerm_network_security_rule" "controller-icmp" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-icmp"
|
name = "allow-icmp"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "1995"
|
priority = "1995"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Icmp"
|
protocol = "Icmp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "*"
|
destination_port_range = "*"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-ssh" {
|
resource "azurerm_network_security_rule" "controller-ssh" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-ssh"
|
name = "allow-ssh"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2000"
|
priority = "2000"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "22"
|
destination_port_range = "22"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-etcd" {
|
resource "azurerm_network_security_rule" "controller-etcd" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-etcd"
|
name = "allow-etcd"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2005"
|
priority = "2005"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "2379-2380"
|
destination_port_range = "2379-2380"
|
||||||
source_address_prefix = azurerm_subnet.controller.address_prefix
|
source_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape etcd metrics
|
# Allow Prometheus to scrape etcd metrics
|
||||||
resource "azurerm_network_security_rule" "controller-etcd-metrics" {
|
resource "azurerm_network_security_rule" "controller-etcd-metrics" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-etcd-metrics"
|
name = "allow-etcd-metrics"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2010"
|
priority = "2010"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "2381"
|
destination_port_range = "2381"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape kube-proxy metrics
|
# Allow Prometheus to scrape kube-proxy metrics
|
||||||
resource "azurerm_network_security_rule" "controller-kube-proxy" {
|
resource "azurerm_network_security_rule" "controller-kube-proxy" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-kube-proxy-metrics"
|
name = "allow-kube-proxy-metrics"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2011"
|
priority = "2011"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "10249"
|
destination_port_range = "10249"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape kube-scheduler and kube-controller-manager metrics
|
# Allow Prometheus to scrape kube-scheduler and kube-controller-manager metrics
|
||||||
resource "azurerm_network_security_rule" "controller-kube-metrics" {
|
resource "azurerm_network_security_rule" "controller-kube-metrics" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-kube-metrics"
|
name = "allow-kube-metrics"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2012"
|
priority = "2012"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "10257-10259"
|
destination_port_range = "10257-10259"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-apiserver" {
|
resource "azurerm_network_security_rule" "controller-apiserver" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-apiserver"
|
name = "allow-apiserver"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2015"
|
priority = "2015"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "6443"
|
destination_port_range = "6443"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-cilium-health" {
|
resource "azurerm_network_security_rule" "controller-cilium-health" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
count = var.networking == "cilium" ? 1 : 0
|
count = var.networking == "cilium" ? 1 : 0
|
||||||
|
|
||||||
name = "allow-cilium-health"
|
name = "allow-cilium-health"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2019"
|
priority = "2019"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4240"
|
destination_port_range = "4240"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-vxlan" {
|
resource "azurerm_network_security_rule" "controller-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-vxlan"
|
name = "allow-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2020"
|
priority = "2020"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4789"
|
destination_port_range = "4789"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "controller-linux-vxlan" {
|
resource "azurerm_network_security_rule" "controller-linux-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-linux-vxlan"
|
name = "allow-linux-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2021"
|
priority = "2021"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "8472"
|
destination_port_range = "8472"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape node-exporter daemonset
|
# Allow Prometheus to scrape node-exporter daemonset
|
||||||
resource "azurerm_network_security_rule" "controller-node-exporter" {
|
resource "azurerm_network_security_rule" "controller-node-exporter" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-node-exporter"
|
name = "allow-node-exporter"
|
||||||
network_security_group_name = azurerm_network_security_group.controller.name
|
network_security_group_name = azurerm_network_security_group.controller.name
|
||||||
priority = "2025"
|
priority = "2025"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "9100"
|
destination_port_range = "9100"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow apiserver to access kubelet's for exec, log, port-forward
|
# Allow apiserver to access kubelet's for exec, log, port-forward
|
||||||
|
@ -191,8 +191,8 @@ resource "azurerm_network_security_rule" "controller-kubelet" {
|
||||||
destination_port_range = "10250"
|
destination_port_range = "10250"
|
||||||
|
|
||||||
# allow Prometheus to scrape kubelet metrics too
|
# allow Prometheus to scrape kubelet metrics too
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.controller.address_prefix
|
destination_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
||||||
|
@ -240,139 +240,139 @@ resource "azurerm_network_security_group" "worker" {
|
||||||
resource "azurerm_network_security_rule" "worker-icmp" {
|
resource "azurerm_network_security_rule" "worker-icmp" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-icmp"
|
name = "allow-icmp"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "1995"
|
priority = "1995"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Icmp"
|
protocol = "Icmp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "*"
|
destination_port_range = "*"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-ssh" {
|
resource "azurerm_network_security_rule" "worker-ssh" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-ssh"
|
name = "allow-ssh"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2000"
|
priority = "2000"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "22"
|
destination_port_range = "22"
|
||||||
source_address_prefix = azurerm_subnet.controller.address_prefix
|
source_address_prefixes = azurerm_subnet.controller.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-http" {
|
resource "azurerm_network_security_rule" "worker-http" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-http"
|
name = "allow-http"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2005"
|
priority = "2005"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "80"
|
destination_port_range = "80"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-https" {
|
resource "azurerm_network_security_rule" "worker-https" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-https"
|
name = "allow-https"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2010"
|
priority = "2010"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "443"
|
destination_port_range = "443"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-cilium-health" {
|
resource "azurerm_network_security_rule" "worker-cilium-health" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
count = var.networking == "cilium" ? 1 : 0
|
count = var.networking == "cilium" ? 1 : 0
|
||||||
|
|
||||||
name = "allow-cilium-health"
|
name = "allow-cilium-health"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2014"
|
priority = "2014"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4240"
|
destination_port_range = "4240"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-vxlan" {
|
resource "azurerm_network_security_rule" "worker-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-vxlan"
|
name = "allow-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2015"
|
priority = "2015"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "4789"
|
destination_port_range = "4789"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_network_security_rule" "worker-linux-vxlan" {
|
resource "azurerm_network_security_rule" "worker-linux-vxlan" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-linux-vxlan"
|
name = "allow-linux-vxlan"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2016"
|
priority = "2016"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Udp"
|
protocol = "Udp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "8472"
|
destination_port_range = "8472"
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape node-exporter daemonset
|
# Allow Prometheus to scrape node-exporter daemonset
|
||||||
resource "azurerm_network_security_rule" "worker-node-exporter" {
|
resource "azurerm_network_security_rule" "worker-node-exporter" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-node-exporter"
|
name = "allow-node-exporter"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2020"
|
priority = "2020"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "9100"
|
destination_port_range = "9100"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow Prometheus to scrape kube-proxy
|
# Allow Prometheus to scrape kube-proxy
|
||||||
resource "azurerm_network_security_rule" "worker-kube-proxy" {
|
resource "azurerm_network_security_rule" "worker-kube-proxy" {
|
||||||
resource_group_name = azurerm_resource_group.cluster.name
|
resource_group_name = azurerm_resource_group.cluster.name
|
||||||
|
|
||||||
name = "allow-kube-proxy"
|
name = "allow-kube-proxy"
|
||||||
network_security_group_name = azurerm_network_security_group.worker.name
|
network_security_group_name = azurerm_network_security_group.worker.name
|
||||||
priority = "2024"
|
priority = "2024"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "10249"
|
destination_port_range = "10249"
|
||||||
source_address_prefix = azurerm_subnet.worker.address_prefix
|
source_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Allow apiserver to access kubelet's for exec, log, port-forward
|
# Allow apiserver to access kubelet's for exec, log, port-forward
|
||||||
|
@ -389,8 +389,8 @@ resource "azurerm_network_security_rule" "worker-kubelet" {
|
||||||
destination_port_range = "10250"
|
destination_port_range = "10250"
|
||||||
|
|
||||||
# allow Prometheus to scrape kubelet metrics too
|
# allow Prometheus to scrape kubelet metrics too
|
||||||
source_address_prefixes = [azurerm_subnet.controller.address_prefix, azurerm_subnet.worker.address_prefix]
|
source_address_prefixes = concat(azurerm_subnet.controller.address_prefixes, azurerm_subnet.worker.address_prefixes)
|
||||||
destination_address_prefix = azurerm_subnet.worker.address_prefix
|
destination_address_prefixes = azurerm_subnet.worker.address_prefixes
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
# Override Azure AllowVNetInBound and AllowAzureLoadBalancerInBound
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_version = ">= 0.13.0, < 2.0.0"
|
required_version = ">= 0.13.0, < 2.0.0"
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = "~> 2.8"
|
azurerm = ">= 2.8, < 4.0"
|
||||||
template = "~> 2.2"
|
template = "~> 2.2"
|
||||||
null = ">= 2.1"
|
null = ">= 2.1"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
terraform {
|
terraform {
|
||||||
required_version = ">= 0.13.0, < 2.0.0"
|
required_version = ">= 0.13.0, < 2.0.0"
|
||||||
required_providers {
|
required_providers {
|
||||||
azurerm = "~> 2.8"
|
azurerm = ">= 2.8, < 4.0"
|
||||||
template = "~> 2.2"
|
template = "~> 2.2"
|
||||||
|
|
||||||
ct = {
|
ct = {
|
||||||
|
|
|
@ -53,16 +53,16 @@ Add firewall rules to the worker security group.
|
||||||
resource "azurerm_network_security_rule" "some-app" {
|
resource "azurerm_network_security_rule" "some-app" {
|
||||||
resource_group_name = "${module.ramius.resource_group_name}"
|
resource_group_name = "${module.ramius.resource_group_name}"
|
||||||
|
|
||||||
name = "some-app"
|
name = "some-app"
|
||||||
network_security_group_name = module.ramius.worker_security_group_name
|
network_security_group_name = module.ramius.worker_security_group_name
|
||||||
priority = "3001"
|
priority = "3001"
|
||||||
access = "Allow"
|
access = "Allow"
|
||||||
direction = "Inbound"
|
direction = "Inbound"
|
||||||
protocol = "Tcp"
|
protocol = "Tcp"
|
||||||
source_port_range = "*"
|
source_port_range = "*"
|
||||||
destination_port_range = "30333"
|
destination_port_range = "30333"
|
||||||
source_address_prefix = "*"
|
source_address_prefix = "*"
|
||||||
destination_address_prefix = module.ramius.worker_address_prefix
|
destination_address_prefixes = module.ramius.worker_address_prefixes
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue