# Egress lockdown for the nightly Grafana sqlite snapshot (card t_9d0428d8). # # Why: grafana-backup used to run `apk add --no-cache rsync openssh-client` at # container start, so every night it dialled the Alpine CDN # (dl-cdn.alpinelinux.org -> Fastly 151.101.x.132:443) and kept firing the # `egress-new-dst` flow alert whenever that anycast address rotated. The # toolchain is now baked into the image (images/backup/Dockerfile) and this # policy makes any future runtime fetch fail loudly instead of silently # reaching the internet. # # `monitoring` has no namespace-wide default-deny, so selecting the backup pod # here isolates it on its own: the rules below are the complete egress allow # list and everything else (including `world`) is dropped. `egressDeny` is # stated explicitly so the intent survives a future namespace-wide allow being # added — Cilium deny always beats allow. # # Needs: cluster DNS (the script resolves nothing itself, but the image and any # `ssh` target lookup would), and root@10.10.0.5:22 — that is the Linode node's # InternalIP, so Cilium classifies it `remote-node`, not `world`. The registry # pull and the Grafana PVC access are not pod traffic and are unaffected. apiVersion: cilium.io/v2 kind: CiliumNetworkPolicy metadata: name: grafana-backup-egress namespace: monitoring labels: app: grafana-backup spec: description: >- grafana-backup pod: cluster DNS + SSH to the backup host (10.10.0.5:22) only; no internet egress at run time. endpointSelector: matchLabels: app: grafana-backup egress: - toEndpoints: - matchLabels: io.kubernetes.pod.namespace: kube-system k8s-app: kube-dns toPorts: - ports: - port: "53" protocol: UDP - port: "53" protocol: TCP - toEntities: - remote-node toPorts: - ports: - port: "22" protocol: TCP egressDeny: - toEntities: - world