Files
homelab-gitops/apps/backup/README.md
T

1.4 KiB

Cluster backups

The first backup schedule dumps every database and the global roles from the host PostgreSQL server on arschrock. It uses the host Unix socket and peer authentication; no database password or fixed ClusterIP is stored in Git. The pod is pinned to arschrock and checks that /mnt/backup is on bcachefs before creating output. Kubernetes uses hostPath.type: Directory, never DirectoryOrCreate.

One-time host preparation: sudo install -d -o 962 -g 962 -m 0700 /mnt/backup/kubernetes/postgresql/arschrock. Verify UID 962 still belongs to the host postgres user before changing it. Existing files directly under /mnt/backup are untouched. Each run writes a timestamped directory with globals.sql, one custom-format dump per database, and a complete marker written only after all dumps validate with pg_restore --list. A directory without complete is incomplete and must not be used for restore. No automatic retention or deletion is enabled yet.

The Prometheus rules in apps/prometheus/resources/backup-alerts.yaml alert on failed jobs and a missing or stale successful host PostgreSQL backup. This is not yet a complete cluster backup: in-cluster PostgreSQL, Valkey, CephFS, and RGW/S3 still need schedules, credential handling, and restore tests. etcd and RBD were explicitly deferred. The old scripts and files in /mnt/backup are intentionally preserved.