cloudnative-pg
by QuenchWorks
CloudNativePG, the Kubernetes operator for PostgreSQL high availability: replicas, automated failover and backups, running clusters on the QuenchWorks PostgreSQL image. Hardened by QuenchWorks as minimal, nonroot, CVE-gated images, cosign-signed and pinned by digest.
About this chart
cloudnative-pg
The CloudNativePG operator: PostgreSQL clusters on Kubernetes with streaming
replicas, automated failover, rolling updates and backups, declared as a Cluster
resource. The operator and the PostgreSQL pods both run QuenchWorks images:
hardened, CVE-gated, pinned by digest and cosign-signed.
Install
helm install cnpg oci://ghcr.io/quenchworks/charts/cloudnative-pg --namespace cnpg-system --create-namespace
Then create a cluster in any namespace:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: pg
spec:
instances: 3
postgresUID: 1001
postgresGID: 1001
storage:
size: 10Gi
Applications use the pg-rw Service (primary) or pg-ro (replicas) with the
credentials in the pg-app Secret.
How it runs
- One image, two roles. The operator copies its own binary into each PostgreSQL
pod through a bootstrap initContainer, where it runs as the instance manager.
OPERATOR_IMAGE_NAMEis set to this chart's digest-pinned image for that reason. - PostgreSQL image. Clusters without
spec.imageNameuse the QuenchWorks postgresql image (postgresImage), referenced by tag and digest: CloudNativePG reads the major version from the tag. That image runs as uid 1001, so setpostgresUIDandpostgresGIDto 1001 (CloudNativePG defaults to 26). - Webhooks. The operator issues its own webhook certificate and injects the CA
into the webhook configurations. Their names, the
cnpg-webhook-serviceService and thecnpg-default-monitoringConfigMap are upstream's fixed names: install one operator per cluster. - CRDs (eleven, from 1.30.1) are in
crds/. Helm installs them once and never upgrades them; apply a newer chart'scrds/withkubectl apply --server-side.
Values
| Key | Default | Meaning |
|---|---|---|
postgresImage | postgresql 18.6 | default spec.imageName for clusters |
config | {} | operator settings (INHERITED_LABELS, WATCH_NAMESPACE, ...) |
replicaCount | 1 | operator replicas (leader-elected) |
maxConcurrentReconciles | 10 | reconcile workers |
Release gate
On kind, the gate installs the operator, creates a one-instance Cluster on the
default image, waits for it to be Ready, and runs a query as the generated app
user over TCP.
The chart depends on the quench-common chart from oci://ghcr.io/quenchworks/charts.
Deploy cloudnative-pg with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cloudnative-pg on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartcloudnative-pg is pinned at v0.0.17 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply