Managed PostgreSQL (CloudNativePG)
Okustera Managed PostgreSQL runs upstream PostgreSQL 16 orchestrated by the cloud-native CloudNativePG operator.
It combines the battle-tested durability of PostgreSQL with Kubernetes-native automated self-healing, rolling minor upgrades, synchronous replication, and Point-in-Time Recovery (PITR).
Architectural Highlights
- Instantaneous Failover: Quorum election and promotion take $< 5$ seconds using native PostgreSQL replication.
- Separated Read/Write Endpoints: Built-in Kubernetes services routing write traffic to the primary (
<name>-rw) and read queries to standbys (<name>-ro). - Continuous S3 Archiving (Barman): Every write-ahead log (WAL) is immediately streamed to S3-compatible object storage for Point-in-Time Recovery (PITR) up to the exact minute.
- Zero-Downtime Rolling Minor Upgrades: Operator applies minor version patches sequentially with graceful switchovers.
Provisioning with Terraform
The official Okustera Terraform provider delivers full declarative control over your PostgreSQL instances:
resource "okustera_database_postgresql" "app_database" {
name = "production-crm-db"
instances = 3
storage_size_gb = 100
storage_class = "ceph-nvme"
database_name = "crm"
enable_backups = true
parameters = {
"max_connections" = "300"
"shared_buffers" = "2GB"
"effective_cache_size" = "6GB"
"maintenance_work_mem" = "512MB"
}
}
output "db_connection" {
value = okustera_database_postgresql.app_database.connection_string
sensitive = true
}
Refer to the Terraform Resource Reference for full argument documentation.
Connecting to PostgreSQL
1. Connection String Format
postgresql://<user>:<password>@<name>-rw.omc-system.svc.cluster.local:5432/<database_name>?sslmode=require
2. Python (psycopg2 / asyncpg) Example
import asyncpg
import asyncio
async def main():
conn = await asyncpg.connect(
user='app_user',
password='<PASSWORD>',
database='crm',
host='production-crm-db-rw.omc-system.svc.cluster.local',
port=5432,
ssl='require'
)
version = await conn.fetchval('SELECT version()')
print("Connected to:", version)
await conn.close()
asyncio.run(main())
Point-in-Time Recovery (PITR)
To restore a database cluster to a specific timestamp in the past:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: crm-db-restored
spec:
instances: 3
storage:
size: 100Gi
storageClass: ceph-nvme
bootstrap:
recovery:
source: production-crm-db
recoveryTarget:
targetTime: "2026-09-10T14:30:00Z"
For complete architecture details on Barman S3 WAL streaming, RPO/RTO SLAs, and disaster recovery runbooks, see the Replication, Backups & Disaster Recovery Guide.