cnpg-stack

by QuenchWorks

Helm chartv0.0.32App 1.30.1Apache-2.0Verified publisher

Operator-managed HA PostgreSQL in one install: the CloudNativePG operator + a replicated Cluster (streaming replication, automated failover, built-in metrics) + a PgBouncer Pooler in front of the primary. Every image is QuenchWorks-hardened, nonroot, CVE-gated, pinned by digest and cosign-signed.

About this chart

Quenchworks cnpg-stack

Operator-managed HA PostgreSQL in one install:

  • the CloudNativePG operator,
  • a Cluster: a primary plus streaming replicas, automated failover, metrics on port 9187 of every instance,
  • a PgBouncer Pooler in front of the primary, running the catalog pgbouncer image.

Every image is minimal, nonroot, CVE-gated, cosign-signed and pinned by digest. For HA without an operator, see postgres-ha-stack (Patroni).

Install

The operator's CRDs, ClusterRole and webhooks are cluster-wide: one operator per cluster.

helm install pg oci://ghcr.io/quenchworks/charts/cnpg-stack -n db --create-namespace
kubectl -n db get cluster pg-pg
kubectl -n db get secret pg-pg-app -o jsonpath='{.data.uri}' | base64 -d; echo

Apps connect to pg-pg-pooler-rw:5432 (PgBouncer to the primary), or directly to pg-pg-rw (primary), pg-pg-ro (replicas) and pg-pg-r (any instance).

The Cluster and Pooler are applied by a post-install/upgrade hook Job, because the operator's admission webhook is not serving yet when Helm applies the release. They are not release objects, so helm uninstall keeps the database and its volumes. Remove them with kubectl delete cluster pg-pg and kubectl delete pooler pg-pg-pooler-rw.

Configuration

KeyDefaultMeaning
cluster.enabledtrueCreate the Cluster
cluster.instances3Primary plus replicas
cluster.storage.size8GiPer instance
cluster.storage.storageClass""Default class when empty
cluster.database, cluster.ownerappCreated at bootstrap; password in <release>-pg-app
cluster.extraSpec{}Merged into the Cluster spec (parameters, backup, affinity)
pooler.enabledtrueCreate the PgBouncer Pooler
pooler.instances2Pooler replicas
pooler.poolModesessionsession or transaction
pooler.parameters{}PgBouncer parameters
cloudnative-pg.*Passed to the cloudnative-pg chart (its postgresImage is the database image)

Deploy cnpg-stack with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cnpg-stack 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcnpg-stack is pinned at v0.0.32 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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