monitoring/grafana-backup, forgejo/cluster-backup and sirius-growth/leadgen-backup all ran `apk add --no-cache rsync openssh-client` at container start. Every night that dialled dl-cdn.alpinelinux.org (Fastly anycast 151.101.x.132:443), which is what `egress-new-dst` kept reporting, and made the backups depend on the public internet at 03:00 UTC. - image: forgejo.siriusdevops.com/sirius/backup-tools, built in CI from python:3.12-alpine (pinned by digest) + rsync + openssh-client + bash + kubectl v1.36.4 (release sha256 verified at build). Pinned by digest in all three CronJobs, no apk in any backup path. - egress: CiliumNetworkPolicy per backup pod — cluster DNS and 10.10.0.5:22 for all three, plus kube-apiserver 6443/443 for cluster-backup only, with an explicit deny for `world` (Cilium unions namespace policies, so the allow list alone would not restrict a pod inside `forgejo`/`sirius-growth`). - monitoring gains the registry pull secret it never needed before; the job now keeps imagePullSecrets: forgejo-pull (SOPS-encrypted in git). Schedules, retention, destination paths, entrypoints and RBAC are unchanged.
64 lines
2.2 KiB
YAML
64 lines
2.2 KiB
YAML
# Egress lockdown for the nightly cluster-backup CronJob (card t_9d0428d8).
|
|
#
|
|
# Why: the job used to `apk add --no-cache rsync openssh-client` at container
|
|
# start, so each run depended on the Alpine CDN (Fastly 151.101.x.132:443) and
|
|
# tripped `egress-new-dst` whenever that anycast address rotated. rsync/ssh/
|
|
# bash/kubectl are baked into images/backup/Dockerfile now.
|
|
#
|
|
# `forgejo-allow` (networkpolicy.yaml) selects every pod in this namespace and
|
|
# allows `world`, so a pod-scoped allow list alone would NOT restrict the job —
|
|
# Cilium unions multiple policies. The `egressDeny` for `world` below is what
|
|
# actually closes it (deny always beats allow), and it is scoped to this pod by
|
|
# the endpointSelector, so Forgejo's own webhooks/mirror/avatar egress is
|
|
# untouched.
|
|
#
|
|
# Allow list, and nothing else:
|
|
# * cluster DNS;
|
|
# * [email protected]:22 — the Linode node's InternalIP, so `remote-node`, not
|
|
# `world` (the rsync target and every ssh_r call);
|
|
# * kube-apiserver on 6443/443 — `kubectl get cluster` for the CNPG primary
|
|
# and `kubectl exec ... pg_dump` for both CNPG and the plain Postgres
|
|
# Deployment. Port-scoped on purpose: the apiserver shares its host IP with
|
|
# the internal Gateway listeners on 8081/8084-8087.
|
|
apiVersion: cilium.io/v2
|
|
kind: CiliumNetworkPolicy
|
|
metadata:
|
|
name: cluster-backup-egress
|
|
namespace: forgejo
|
|
labels:
|
|
app: cluster-backup
|
|
spec:
|
|
description: >-
|
|
cluster-backup pod: cluster DNS, SSH to the backup host (10.10.0.5:22) and
|
|
the API (6443/443) only; no internet egress at run time.
|
|
endpointSelector:
|
|
matchLabels:
|
|
app: cluster-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
|
|
- toEntities:
|
|
- kube-apiserver
|
|
toPorts:
|
|
- ports:
|
|
- port: "6443"
|
|
protocol: TCP
|
|
- port: "443"
|
|
protocol: TCP
|
|
egressDeny:
|
|
- toEntities:
|
|
- world
|