2017-08-13 02:03:01 +02:00
|
|
|
resource "digitalocean_firewall" "rules" {
|
|
|
|
name = "${var.cluster_name}"
|
|
|
|
|
|
|
|
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
|
2017-08-13 02:03:01 +02:00
|
|
|
inbound_rule = [
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "22"
|
2017-08-13 02:03:01 +02:00
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "udp"
|
2019-04-03 08:02:04 +02:00
|
|
|
port_range = "8472"
|
2017-08-17 04:19:25 +02:00
|
|
|
source_tags = ["${digitalocean_tag.controllers.name}", "${digitalocean_tag.workers.name}"]
|
2017-08-13 02:03:01 +02:00
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "tcp"
|
2019-04-03 08:02:04 +02:00
|
|
|
port_range = "9100"
|
|
|
|
source_tags = ["${digitalocean_tag.workers.name}"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "10250"
|
2017-08-17 04:19:25 +02:00
|
|
|
source_tags = ["${digitalocean_tag.controllers.name}", "${digitalocean_tag.workers.name}"]
|
2017-08-13 02:03:01 +02:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
# allow all outbound traffic
|
|
|
|
outbound_rule = [
|
|
|
|
{
|
2018-01-16 06:27:06 +01:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "1-65535"
|
2017-08-13 02:03:01 +02:00
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2017-08-13 03:25:05 +02:00
|
|
|
protocol = "udp"
|
2018-01-16 06:27:06 +01:00
|
|
|
port_range = "1-65535"
|
2017-08-13 02:03:01 +02:00
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2018-01-16 06:27:06 +01:00
|
|
|
protocol = "icmp"
|
|
|
|
port_range = "1-65535"
|
2017-08-13 02:03:01 +02:00
|
|
|
destination_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
2019-04-03 08:02:04 +02:00
|
|
|
|
|
|
|
resource "digitalocean_firewall" "controllers" {
|
|
|
|
name = "${var.cluster_name}-controllers"
|
|
|
|
|
|
|
|
tags = ["${var.cluster_name}-controller"]
|
|
|
|
|
|
|
|
# etcd, kube-apiserver, kubelet
|
|
|
|
inbound_rule = [
|
|
|
|
{
|
2019-04-07 11:29:07 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "2379-2380"
|
2019-04-03 08:02:04 +02:00
|
|
|
source_tags = ["${digitalocean_tag.controllers.name}"]
|
|
|
|
},
|
|
|
|
{
|
2019-04-07 11:29:07 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "2381"
|
2019-04-03 08:02:04 +02:00
|
|
|
source_tags = ["${digitalocean_tag.workers.name}"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "6443"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_firewall" "workers" {
|
|
|
|
name = "${var.cluster_name}-workers"
|
|
|
|
|
|
|
|
tags = ["${var.cluster_name}-worker"]
|
|
|
|
|
|
|
|
# allow HTTP/HTTPS ingress
|
|
|
|
inbound_rule = [
|
|
|
|
{
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "80"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "443"
|
|
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
|
|
},
|
|
|
|
{
|
2019-04-07 11:29:07 +02:00
|
|
|
protocol = "tcp"
|
|
|
|
port_range = "10254"
|
2019-04-03 08:02:04 +02:00
|
|
|
source_addresses = ["0.0.0.0/0"]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|