Databases
Databases on the ayedo SDP: overview and operation of PostgreSQL with CloudNativePG (HA, Barman Cloud Plugin, ObjectStore CR, PITR) and Managed MongoDB.
Databases on the SDP
The ayedo Software Delivery Platform (SDP) supports running relational and document databases in production directly on Kubernetes. Two solutions form the documented standard within the platform:
| Database | Technology on the SDP | Key Features | Detailed Documentation |
|---|---|---|---|
| PostgreSQL | CloudNativePG (CNPG) | Kubernetes-native operator, HA with automatic failover, continuous archiving via the Barman Cloud Plugin (ObjectStore CR), and Point-in-Time Recovery (PITR) |
This page |
| MongoDB | Managed MongoDB | Highly available replica set, automatic primary election, instance backups, and clear boundaries for partial restores | Managed MongoDB |
PostgreSQL with CloudNativePG (CNPG)
CloudNativePG manages the entire lifecycle of PostgreSQL clusters declaratively via Kubernetes Custom Resources (Cluster, Backup, ScheduledBackup).
High Availability and Topology
A production CloudNativePG cluster typically runs with 3 instances (1 primary and 2 streaming replicas). For zero-downtime rolling updates with Pod Anti-Affinity and Pod Disruption Budgets, we recommend at least 4 worker nodes in the cluster (see Operating Models — Reference Sizing).
CloudNativePG automatically creates three Kubernetes Services per cluster:
| Service | Target | Typical Usage |
|---|---|---|
<cluster>-rw |
Current primary | Read and write traffic from your application |
<cluster>-ro |
Read replicas | Read-heavy queries and reporting |
<cluster>-r |
All instances (primary + replicas) | Read workloads including the primary |
If the primary fails, the operator automatically promotes an up-to-date replica to become the new primary and seamlessly redirects the <cluster>-rw Service.
Connecting from Applications
For the default application database, CloudNativePG automatically creates a Kubernetes Secret (<cluster>-app) containing host, port, database name, username, password, and a ready-to-use uri. Always reference credentials in your Deployments via secretKeyRef or via OpenBao with the External Secrets Operator — never in plain text in Git.
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: acme-db-app
key: uri
Always enforce TLS for connections (sslmode=require or sslmode=verify-full) and configure your application connection parameters to be resilient against brief failover transitions (connection pooling, retry logic).
Backups with the Barman Cloud Plugin (ObjectStore CR)
CloudNativePG continuously backs up PostgreSQL clusters to S3-compatible object storage (such as Ceph RGW, RustFS, or external S3) via the Barman Cloud Plugin (barman-cloud.cloudnative-pg.io). It combines two mechanisms:
- Base Backups: Full physical backups of the database.
- Continuous WAL Archiving: Ongoing archiving of all Write-Ahead Logs (WAL) as the foundation for second-level recovery (Point-in-Time Recovery / PITR).
Step 1: Define the ObjectStore Custom Resource
The S3 target configuration is cleanly separated from the database definition in an ObjectStore resource (barmancloud.cnpg.io/v1):
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: acme-db-backup-store
namespace: acme-prod
spec:
configuration:
destinationPath: s3://acme-db-backups/
endpointURL: https://s3.acme.corp
s3Credentials:
accessKeyId:
name: acme-db-s3-credentials
key: ACCESS_KEY_ID
secretAccessKey:
name: acme-db-s3-credentials
key: ACCESS_SECRET_KEY
wal:
compression: gzip
Step 2: Enable the Plugin in the PostgreSQL Cluster
Reference the ObjectStore via spec.plugins in your CloudNativePG Cluster:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: acme-db
namespace: acme-prod
spec:
instances: 3
storage:
size: 50Gi
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: acme-db-backup-store
Step 3: Scheduled Backups (ScheduledBackup)
Regular base backups are triggered through a ScheduledBackup resource with method: plugin:
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: acme-db-scheduled
namespace: acme-prod
spec:
schedule: "0 0 2 * * *"
backupOwnerReference: self
cluster:
name: acme-db
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
Inspect the status of clusters, backups, and schedules directly with kubectl:
kubectl get cluster,backup,scheduledbackup -n acme-prod
kubectl describe cluster acme-db -n acme-prod
In-Cluster Recovery & Point-in-Time Recovery (PITR)
CloudNativePG never performs destructive in-place restores. Instead, it bootstraps a new PostgreSQL cluster from the backed-up ObjectStore. This preserves the previous state for investigation and lets you safely validate the restored state before switching over your application.
Example: Restore to an Exact Point in Time (PITR)
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: acme-db-restored
namespace: acme-prod
spec:
instances: 3
storage:
size: 50Gi
bootstrap:
recovery:
source: acme-db-origin
recoveryTarget:
targetTime: "2026-11-29 10:30:00.00000+00"
externalClusters:
- name: acme-db-origin
plugin:
name: barman-cloud.cloudnative-pg.io
parameters:
barmanObjectName: acme-db-backup-store
serverName: acme-db
If you omit recoveryTarget, CloudNativePG automatically restores the latest available state from the base backup and all archived WAL files.
For detailed guides on downloading backups, external recovery, and logical exports (pg_dump), see Backup & Restore.
Monitoring & Logs
CloudNativePG exposes comprehensive PostgreSQL and replication metrics for VictoriaMetrics and writes structured logs on stdout/stderr to VictoriaLogs. All metrics (connections, replication lag, disk utilization, WAL archiving) are available in Grafana, where you can also configure custom alerts (User Alerts).
Managed MongoDB
For document-oriented workloads, the SDP provides Managed MongoDB as a highly available replica set with automatic primary election and managed instance backups. All details regarding handover, credentials, failover behavior, backup boundaries, and the operational checklist are documented on the dedicated Managed MongoDB page.
Further Documentation
- Managed MongoDB — Replica set, credentials, and backup scope
- Backup & Restore — Detailed recovery workflows for CNPG, Velero, and databases
- Platform Storage — StorageClasses and persistent volumes
- Private Object Storage — S3 buckets on Ceph RGW and RustFS
- Service Annex to the Terms and Conditions — Binding backup and recovery services