From fa33bf44aebcf72a631bacb77c1fa623dfe18bcb Mon Sep 17 00:00:00 2001 From: Ruben Hensen Date: Mon, 26 Oct 2026 23:26:06 +0100 Subject: [PATCH] external-secrets: NetworkPolicy, through a folder app of its own --- apps/templates/external-secrets-folder.yaml | 19 ++++++ external-secrets/networkpolicy.yaml | 68 +++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 apps/templates/external-secrets-folder.yaml create mode 100644 external-secrets/networkpolicy.yaml diff --git a/apps/templates/external-secrets-folder.yaml b/apps/templates/external-secrets-folder.yaml new file mode 100644 index 0000000..f069ccd --- /dev/null +++ b/apps/templates/external-secrets-folder.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: external-secrets-folder + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://github.com/rubenhensen/k8scd.git + targetRevision: HEAD + path: external-secrets + destination: + server: https://kubernetes.default.svc + namespace: external-secrets + syncPolicy: + automated: + selfHeal: true diff --git a/external-secrets/networkpolicy.yaml b/external-secrets/networkpolicy.yaml new file mode 100644 index 0000000..2e92435 --- /dev/null +++ b/external-secrets/networkpolicy.yaml @@ -0,0 +1,68 @@ +# External Secrets' three pods reach each other, DNS and the API server +# (the node, port 16443); the controller also reads Vault +# (vault-active.vault.svc:8200, which vault/networkpolicy.yaml lets it +# into). Besides their own namespace they take connections only from the +# node: the API server calls the webhook from there and the kubelet probes +# come from there too (10.1.7.64 is the node's Calico VXLAN address, +# projectcalico.org/IPv4VXLANTunnelAddr). The Password generator behind +# gatus/backup-check-token needs no network. The chart's Application +# (apps/templates/external-secrets-helm.yaml) only installs the chart, so +# this folder gets an Application of its own, external-secrets-folder. +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: default +spec: + podSelector: {} + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: {} + - from: + - ipBlock: + cidr: 192.168.1.204/32 + - ipBlock: + cidr: 10.1.7.64/32 + egress: + - to: + - podSelector: {} + - 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: 192.168.1.204/32 + ports: + - port: 16443 +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: controller-to-vault +spec: + podSelector: + matchLabels: + app.kubernetes.io/name: external-secrets + policyTypes: + - Egress + egress: + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: vault + podSelector: + matchLabels: + app.kubernetes.io/name: vault + ports: + - port: 8200