feat(backup): run the three nightly backups from a pinned image with an egress allow list
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.
This commit is contained in:
parent
d44ca50dd1
commit
0acc089dc3
10 changed files with 242 additions and 22 deletions
|
|
@ -27,10 +27,10 @@ data:
|
|||
# T480's root filesystem, the only local file is a ~3 MB copy in /tmp.
|
||||
set -eu
|
||||
|
||||
if ! command -v rsync >/dev/null || ! command -v ssh >/dev/null; then
|
||||
echo "== installing rsync + openssh-client"
|
||||
apk add --no-cache rsync openssh-client >/dev/null
|
||||
fi
|
||||
# No package install here on purpose: rsync/openssh-client/python3 are
|
||||
# baked into the pinned image (images/backup/Dockerfile) and this pod's
|
||||
# egress policy admits DNS + 10.10.0.5:22 only, so a runtime fetch would
|
||||
# fail rather than silently dial the Alpine CDN (card t_9d0428d8).
|
||||
|
||||
BACKUP_HOST=${BACKUP_HOST:[email protected]}
|
||||
BACKUP_DIR=${BACKUP_DIR:-/root/cluster-backup}
|
||||
|
|
@ -128,15 +128,22 @@ spec:
|
|||
app: grafana-backup
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
# Pulled from the in-cluster Forgejo registry (which requires auth);
|
||||
# monitoring had no registry pull secret before this job needed one.
|
||||
imagePullSecrets:
|
||||
- name: forgejo-pull
|
||||
# The grafana PVC is local-path on siriussec; RWO still allows a
|
||||
# second pod on the same node.
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: siriussec
|
||||
containers:
|
||||
- name: backup
|
||||
# python3 alpine: the sqlite backup API is the only consistent
|
||||
# way to copy a live database without a shell inside Grafana.
|
||||
image: python:3.12-alpine
|
||||
# python3.12-alpine + rsync + openssh-client, baked at build time
|
||||
# and pinned by digest (images/backup/Dockerfile, CI workflow
|
||||
# .forgejo/workflows/backup-image.yml). The sqlite backup API is
|
||||
# the only consistent way to copy a live database without a shell
|
||||
# inside Grafana. Nothing is installed at run time.
|
||||
image: forgejo.siriusdevops.com/sirius/backup-tools@sha256:cc8dc1645111b3a80b7c4d5168f6bce3002cae7417b3725683c057976f6e379a
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ["/bin/sh", "/scripts/backup.sh"]
|
||||
env:
|
||||
|
|
|
|||
Loading…
Reference in a new issue