Backup & Restore
Backup and restore concepts on the ayedo SDP: CloudNativePG with the Barman Cloud Plugin and ObjectStore CR, in-cluster recovery, export, Velero, and MongoDB.
Backup & Restore
A well-designed backup and recovery strategy protects your applications on the ayedo Software Delivery Platform (SDP) against human error, failed migrations, and data loss. This page explains how CloudNativePG (PostgreSQL) and Velero (Kubernetes resources and volumes) work together, as well as how Managed MongoDB is handled.
Overview of Backup Layers
| Layer / Service | Mechanism | Backup Target & Notes |
|---|---|---|
| PostgreSQL (CloudNativePG) | Barman Cloud Plugin + ObjectStore CR (Base Backups + continuous WAL archiving) |
S3-compatible object storage (Ceph RGW / RustFS); enables Point-in-Time Recovery (PITR) |
| Kubernetes Resources & PVCs | Velero (Backup, Schedule) |
S3-compatible object storage; backs up manifests and persistent volumes |
| MongoDB | Instance backups within managed scope or application-level dumps (mongodump) |
Details and boundaries under Managed MongoDB |
1. PostgreSQL with CloudNativePG (Barman Cloud Plugin)
CloudNativePG (CNPG) creates physical backups based on pg_basebackup combined with continuous Write-Ahead Log (WAL) archiving via the Barman Cloud Plugin (barman-cloud.cloudnative-pg.io) and an ObjectStore Custom Resource (barmancloud.cnpg.io/v1).
Check Backup Status in Your Namespace
# List running and completed backups as well as schedules
kubectl get backup,scheduledbackup,objectstore -n acme-production
# Detailed PostgreSQL cluster status (including last successful backup & WAL archiving)
kubectl describe cluster acme-db -n acme-production
Trigger a Manual On-Demand Backup
Before running major schema migrations, you can trigger an additional on-demand backup at any time:
apiVersion: postgresql.cnpg.io/v1
kind: Backup
metadata:
name: acme-db-pre-migration
namespace: acme-production
spec:
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
cluster:
name: acme-db
2. CNPG In-Cluster Recovery (Recommended)
CloudNativePG does not restore databases in place; instead, it bootstraps a new PostgreSQL cluster from the existing ObjectStore backup. This leaves the original data untouched during verification — ideal for production recovery, Point-in-Time Recovery (PITR), or cloning into a staging environment.
Example: Restore a New Cluster from ObjectStore
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: acme-db-restore
namespace: acme-production
spec:
instances: 3
storage:
size: 50Gi
storageClass: ceph-rbd
bootstrap:
recovery:
source: source-cluster
# Optional: Point-in-Time Recovery (RFC 3339)
recoveryTarget:
targetTime: "2026-11-29T10:30:00Z"
externalClusters:
- name: source-cluster
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: acme-db-objectstore
serverName: acme-db
Supported PITR Targets (recoveryTarget)
| Field | Description |
|---|---|
targetTime |
Exact timestamp in RFC 3339 format (e.g., 2026-11-29T10:30:00Z) |
targetLSN |
Specific PostgreSQL Log Sequence Number |
targetXID |
Specific Transaction ID |
targetName |
Named restore point (created via pg_create_restore_point()) |
targetImmediate |
Earliest consistent state after the base backup |
3. Inspecting, Downloading, and Logically Exporting Backups
Obtaining S3 Credentials
- Managed SDP: If needed, request temporary read-only S3 credentials for your backup bucket through your agreed support channel (support@ayedo.de). Include your cluster name, namespace, and CNPG cluster name.
- Self-Managed SDP: Read the backup secret reference directly from the
ObjectStoreresource in your namespace (kubectl get objectstore -n acme-production -o yaml).
Inspect Backup Contents on S3 (AWS CLI or mc)
Using the AWS CLI (aws s3)
export AWS_ACCESS_KEY_ID="<access-key>"
export AWS_SECRET_ACCESS_KEY="<secret-key>"
export S3_ENDPOINT="https://s3.example.com"
# Inspect directory structure (base/ and wals/)
aws --endpoint-url "$S3_ENDPOINT" s3 ls s3://acme-db-backups/acme-db/
aws --endpoint-url "$S3_ENDPOINT" s3 ls s3://acme-db-backups/acme-db/base/
Using the S3 CLI Client mc
# Configure connection
mc alias set acme-backup https://s3.example.com "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY"
# List base backups and WAL archives
mc ls acme-backup/acme-db-backups/acme-db/base/
mc ls acme-backup/acme-db-backups/acme-db/wals/
# Check storage usage
mc du acme-backup/acme-db-backups/acme-db/
External Recovery with Barman Cloud Tools
If you need to restore a physical CNPG backup outside the cluster (for example on a dedicated restore VM running the same PostgreSQL major version), use the official barman-cloud tools (pipx install "barman[cloud]"):
export AWS_ACCESS_KEY_ID="<access-key>"
export AWS_SECRET_ACCESS_KEY="<secret-key>"
# Extract the base backup into a local restore directory
barman-cloud-restore \
--cloud-provider aws-s3 \
--endpoint-url https://s3.example.com \
s3://acme-db-backups/acme-db \
<backup-id> \
/var/lib/postgresql/restore
For Point-in-Time Recovery, configure restore_command in /var/lib/postgresql/restore/postgresql.auto.conf using barman-cloud-wal-restore with an absolute path (never use ~ tilde expansion in PostgreSQL configuration files), and create recovery.signal.
Logical Export with pg_dump and pg_restore
For selective restoration of individual tables, migrations across PostgreSQL major versions, or portable exports, perform a logical export after an in-cluster restore (or directly against a read replica):
# Compressed custom dump (supports selective table restore)
pg_dump -h localhost -U appuser -d acme \
--format=custom \
--file=acme-export.dump
# Restore a specific table
pg_restore -h localhost -U appuser -d acme_target \
--table=orders \
--clean --if-exists \
acme-export.dump
4. Kubernetes Resources and Volumes with Velero
Velero backs up Kubernetes manifests (Deployments, ConfigMaps, Secrets, Services, Ingresses) as well as associated PersistentVolumes of a namespace to S3 object storage when needed.
# List existing Velero backups and schedules (depending on permissions)
velero backup get
velero schedule get
# Create a targeted namespace backup (Self-Managed / with appropriate permissions)
velero backup create acme-pre-release \
--include-namespaces acme-production \
--wait
# Restore a namespace from a backup
velero restore create --from-backup acme-pre-release \
--include-namespaces acme-production
Best Practices for Teams
- Regular restore drills: A backup is only reliable once recovery has been successfully tested in an isolated test or staging environment.
- Back up before migrations: Create a named on-demand backup before major database or release changes.
- Encrypt downloaded dumps: Protect locally exported dumps (for example with
gpgorage) and delete temporary copies once analysis is complete.