2017-08-13 02:03:01 +02:00
|
|
|
resource "digitalocean_firewall" "rules" {
|
2019-05-28 00:37:36 +02:00
|
|
|
name = var.cluster_name
|
2017-08-13 02:03:01 +02:00
|
|
|
|
|
|
|
tags = ["${var.cluster_name}-controller", "${var.cluster_name}-worker"]
|
|
|
|
|
2019-04-03 08:02:04 +02:00
|
|
|
# allow ssh, internal flannel, internal node-exporter, internal kubelet
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "22"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
|
|
|
|
|
|
|
inbound_rule {
|
|
|
|
protocol = "udp"
|
|
|
|
port_range = "4789"
|
|
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
|
|
}
|
|
|
|
|
2019-12-29 21:21:49 +01:00
|
|
|
# Allow Prometheus to scrape node-exporter
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "9100"
|
|
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
|
|
}
|
|
|
|
|
2019-12-29 21:21:49 +01:00
|
|
|
# Allow Prometheus to scrape kube-proxy
|
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "10249"
|
|
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
|
|
}
|
|
|
|
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "10250"
|
|
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
|
|
}
|
2017-08-13 02:03:01 +02:00
|
|
|
|
|
|
|
# allow all outbound traffic
|
2019-05-28 00:37:36 +02:00
|
|
|
outbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "1-65535"
|
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
|
|
|
|
|
|
|
outbound_rule {
|
|
|
|
protocol = "udp"
|
|
|
|
port_range = "1-65535"
|
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
|
|
|
|
|
|
|
outbound_rule {
|
|
|
|
protocol = "icmp"
|
|
|
|
port_range = "1-65535"
|
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
2017-08-13 02:03:01 +02:00
|
|
|
}
|
2019-04-03 08:02:04 +02:00
|
|
|
|
|
|
|
resource "digitalocean_firewall" "controllers" {
|
|
|
|
name = "${var.cluster_name}-controllers"
|
|
|
|
|
|
|
|
tags = ["${var.cluster_name}-controller"]
|
|
|
|
|
2019-09-06 08:12:09 +02:00
|
|
|
# etcd
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "2379-2380"
|
|
|
|
source_tags = [digitalocean_tag.controllers.name]
|
|
|
|
}
|
|
|
|
|
2019-09-06 08:12:09 +02:00
|
|
|
# etcd metrics
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "2381"
|
|
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
|
|
}
|
|
|
|
|
2019-09-06 08:12:09 +02:00
|
|
|
# kube-apiserver
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "6443"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
2019-11-14 08:44:02 +01:00
|
|
|
|
2019-09-06 08:12:09 +02:00
|
|
|
# kube-scheduler metrics, kube-controller-manager metrics
|
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "10251-10252"
|
|
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
|
|
}
|
2019-04-03 08:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_firewall" "workers" {
|
|
|
|
name = "${var.cluster_name}-workers"
|
|
|
|
|
|
|
|
tags = ["${var.cluster_name}-worker"]
|
|
|
|
|
|
|
|
# allow HTTP/HTTPS ingress
|
2019-05-28 00:37:36 +02:00
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "80"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
|
|
|
|
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "443"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
}
|
|
|
|
|
|
|
|
inbound_rule {
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "10254"
|
|
|
|
source_addresses = ["0.0.0.0/0"]
|
|
|
|
}
|
2019-04-03 08:02:04 +02:00
|
|
|
}
|
2019-05-28 00:37:36 +02:00
|
|
|
|