PostgresCluster
resourceType postgresql · provider cnpg · sharing Private · cleanup Orphan
Provisions a dedicated CloudNativePG cluster with an application database and owner role (via bootstrap.initdb), continuous backups to object storage, and the cloud backup storage + identity primitives.
Request it
Add this to your PlatformApplication's spec.resourceRequirements (optional parameters are in the table below):
resourceRequirements:
- resourceType: postgresql
provider: cnpg # selects this backend — the cluster default may differ
resourceName: my-postgresql # your handle — drives the env-var prefix + secret name
parameters:
dbName: "<value>"
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
dbName | string | yes | — | Name of the application database to create on the dedicated cluster. |
owner | string | no | — | Owner role (application user) for the database. Defaults to dbName. |
instances | string | no | 3 | Number of Postgres instances (1 primary + replicas). |
storageSize | string | no | 20Gi | Persistent volume size per instance (e.g. 20Gi). |
postgresVersion | string | no | 16 | PostgreSQL major version (CNPG image tag). |
backupRetention | string | no | 30d | Backup retention policy (e.g. 30d). |
provisionStorage | string | no | true | Provision the backup bucket + identity and enable managed backups: 'true' or 'false'. When 'false', the cluster is created without backups. |
nodeCapacityType | string | no | — | Pin instance pods to a Karpenter capacity type via a nodeSelector on 'karpenter.sh/capacity-type'. Leave unset to accept whatever the NodePool offers. The target NodePool must permit the requested type, or the pods stay Pending. |
doNotDisrupt | string | no | false | Annotate instance pods with 'karpenter.sh/do-not-disrupt' so Karpenter will not voluntarily disrupt the nodes running them. This blocks consolidation AND drift, so those nodes stop picking up AMI/config rollouts until the pods move — prefer it as a targeted fix for churn, not a default. |
Connection
On grant, a connection secret is published with these tokens and injected into your workload as {RESOURCENAME}_{TOKEN} (UPPER_SNAKE) — e.g. resourceName: my-postgresql → MY_POSTGRESQL_HOST, MY_POSTGRESQL_PORT, …:
hostportusernamepassworddbname
Status
| Field | Description |
|---|---|
clusterName | Name of the CNPG cluster. |
databaseName | Name of the application database. |
Auto-generated from the PostgresCluster XRD + postgresql--cnpg ResourceCapability. Do not edit by hand.