Highly available PostgreSQL 16 powered by Patroni and the Spilo image. The chart provisions a primary with streaming replicas, automatic failover, and a post-upgrade hook that applies configuration changes via the Patroni API so PostgreSQL reloads without restarts.
- Patroni-managed primary/replica topology with streaming replication and automatic failover
- Read/write (
-primary) and read-only (-replica) Services plus a headless service for stable DNS - Dynamic configuration updates: change
patroni.postgresql.parametersand runhelm upgradeto apply via Patroni without downtime - PodDisruptionBudget and soft anti-affinity to keep quorum during maintenance
- RBAC + dedicated ServiceAccount; REST API secured with basic auth
# create a namespace (if needed)
kubectl create namespace db || true
# install
helm install nexus-db ./postgres-ha --namespace dbKey endpoints after install (with release name nexus-db):
- Primary (read/write):
nexus-db-postgres-ha-primary:5432 - Replicas (read-only):
nexus-db-postgres-ha-replica:5432 - Patroni API: port
8008on each pod or via the services above
To connect locally:
kubectl -n db port-forward svc/nexus-db-postgres-ha-primary 5432:5432
psql "postgresql://postgres:PerkinzkSecure42@127.0.0.1:5432/postgres"Update these via values.yaml before installing in a real cluster.
- Edit
values.yaml(or a custom values file) and changepatroni.postgresql.parametersorpatroni.synchronousMode. - Run
helm upgrade <release> ./postgres-ha -f <your-values>.yaml. - The
post-install,post-upgradejob(<release>-postgres-ha-apply-config)patches the Patroni API with the rendered config map and triggers a PostgreSQL reload—no pod restarts required.
- Default
replicaCountis 3; keep it ≥3 for reliable leader election and failover. - Services expose port
5432for Postgres and8008for the Patroni API. Health checks also use the API. - Storage defaults to
10GiReadWriteOncePVCs; setstorage.storageClassNameto target a specific class.
helm lint ./postgres-ha(already run locally)