Managed PostgreSQL¶
A PostgreSQL cluster managed by the CloudNativePG operator: one primary and optional streaming replicas with automatic failover.
Create¶
PostgreSQL → Create: name, number of instances, storage size, CPU and memory, optional backup configuration (object storage and retention) and PostgreSQL parameters.
- Instances: 1 is a single primary; 2 or more adds replicas and failover.
- Storage can be increased later, never decreased.
- Databases: create additional databases and owners on a cluster from its detail page.
Connect¶
From workloads in your tenant (apps, instances on the tenant network through the cluster), use the read-write service:
<cluster-name>-rw.<tenant-id>.svc.cluster.local:5432
Credentials are in the secret <cluster-name>-app in your tenant.
Billing¶
vCPU-hours, memory GB-hours and storage GB-hours for every instance of the cluster.
Terraform¶
# A managed PostgreSQL cluster with one primary and one replica.
resource "rso_postgres_cluster" "db" {
name = "tf-example-db"
instances = 2
storage_size = "5Gi"
cpu_request = "100m"
memory_request = "256Mi"
cpu_limit = "500m"
memory_limit = "512Mi"
}
output "postgres_host" {
value = rso_postgres_cluster.db.host
}