diff --git a/dns/kustomization.yaml b/dns/kustomization.yaml index f41d991..41a0ac8 100644 --- a/dns/kustomization.yaml +++ b/dns/kustomization.yaml @@ -7,6 +7,7 @@ resources: - external-secret.yaml - rbac.yaml - cronjob.yaml + - networkpolicy.yaml configMapGenerator: - name: dns-sync-script diff --git a/dns/networkpolicy.yaml b/dns/networkpolicy.yaml new file mode 100644 index 0000000..802b28a --- /dev/null +++ b/dns/networkpolicy.yaml @@ -0,0 +1,37 @@ +# The only pod here is the dns-sync Job (a PostSync hook): it installs its +# Python packages from PyPI and pushes domains/ to TransIP's API, so it +# reaches DNS and the internet (not the LAN, the API server or other +# namespaces). Nothing connects to it. +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: default +spec: + podSelector: {} + policyTypes: + - Ingress + - Egress + egress: + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: kube-system + podSelector: + matchLabels: + k8s-app: kube-dns + ports: + - protocol: UDP + port: 53 + - protocol: TCP + port: 53 + - to: + - ipBlock: + cidr: 0.0.0.0/0 + except: + - 10.0.0.0/8 + - 100.64.0.0/10 + - 169.254.0.0/16 + - 172.16.0.0/12 + - 192.168.0.0/16 + ports: + - port: 443