mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-26 09:39:34 +01:00
e9c8520359
* Accept experimental CNI `networking` mode "cilium" * Run Cilium v1.8.0-rc4 with overlay vxlan tunnels and a minimal set of features. We're interested in: * IPAM: Divide pod_cidr into /24 subnets per node * CNI networking pod-to-pod, pod-to-external * BPF masquerade * NetworkPolicy as defined by Kubernetes (no L7 Policy) * Continue using kube-proxy with Cilium probe mode * Firewall changes: * Require UDP 8472 for vxlan (Linux kernel default) between nodes * Optional ICMP echo(8) between nodes for host reachability (health) * Optional TCP 4240 between nodes for endpoint reachability (health) Known Issues: * Containers with `hostPort` don't listen on all host addresses, these workloads must use `hostNetwork` for now https://github.com/cilium/cilium/issues/12116 * Erroneous warning on Fedora CoreOS https://github.com/cilium/cilium/issues/10256 Note: This is experimental. It is not listed in docs and may be changed or removed without a deprecation notice Related: * https://github.com/poseidon/terraform-render-bootstrap/pull/192 * https://github.com/cilium/cilium/issues/12217
142 lines
3.2 KiB
HCL
142 lines
3.2 KiB
HCL
resource "digitalocean_firewall" "rules" {
|
|
name = var.cluster_name
|
|
|
|
tags = [
|
|
digitalocean_tag.controllers.name,
|
|
digitalocean_tag.workers.name
|
|
]
|
|
|
|
inbound_rule {
|
|
protocol = "icmp"
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# allow ssh, internal flannel, internal node-exporter, internal kubelet
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "22"
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
}
|
|
|
|
# Cilium health
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "4240"
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# IANA vxlan (flannel, calico)
|
|
inbound_rule {
|
|
protocol = "udp"
|
|
port_range = "4789"
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# Linux vxlan (Cilium)
|
|
inbound_rule {
|
|
protocol = "udp"
|
|
port_range = "8472"
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# Allow Prometheus to scrape node-exporter
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "9100"
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# Allow Prometheus to scrape kube-proxy
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "10249"
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# Kubelet
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "10250"
|
|
source_tags = [digitalocean_tag.controllers.name, digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# allow all outbound traffic
|
|
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"]
|
|
}
|
|
}
|
|
|
|
resource "digitalocean_firewall" "controllers" {
|
|
name = "${var.cluster_name}-controllers"
|
|
|
|
tags = [digitalocean_tag.controllers.name]
|
|
|
|
# etcd
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "2379-2380"
|
|
source_tags = [digitalocean_tag.controllers.name]
|
|
}
|
|
|
|
# etcd metrics
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "2381"
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
}
|
|
|
|
# kube-apiserver
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "6443"
|
|
source_addresses = ["0.0.0.0/0", "::/0"]
|
|
}
|
|
|
|
# kube-scheduler metrics, kube-controller-manager metrics
|
|
inbound_rule {
|
|
protocol = "tcp"
|
|
port_range = "10251-10252"
|
|
source_tags = [digitalocean_tag.workers.name]
|
|
}
|
|
}
|
|
|
|
resource "digitalocean_firewall" "workers" {
|
|
name = "${var.cluster_name}-workers"
|
|
|
|
tags = [digitalocean_tag.workers.name]
|
|
|
|
# allow HTTP/HTTPS ingress
|
|
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"]
|
|
}
|
|
}
|
|
|