Run PostgreSQL. The Kubernetes way.
open sourceApache-2.0self-hostablefree
CloudNativePG is a Kubernetes operator that runs PostgreSQL clusters: a Cluster resource declares a primary and any number of streaming replicas, and the operator handles failover, switchover, scaling, rolling minor upgrades and the read-write and read-only services applications connect to. Backups and point-in-time recovery go to object storage through the Barman Cloud plugin or to volume snapshots, replica clusters keep standbys in other Kubernetes clusters, and it manages roles, databases, extensions and a PgBouncer pooler declaratively. It was built by EDB, released under Apache-2.0, and is a CNCF incubating project; its standard Postgres images include pgvector.
Ways to install
Package managers
Problems it solves
- highly available Postgres on our own Kubernetes cluster that promotes a replica by itself when the primary dies
- self-host the database for our app on Kubernetes instead of paying for managed Postgres
- stop hand-managing streaming replication and replicas for Postgres in containers
- continuous Postgres backups to S3 with point-in-time recovery, from inside the cluster
- declare our Postgres cluster, its users, databases and extensions in YAML and let something keep it that way
- upgrade Postgres minor versions with a rolling update and a switchover instead of downtime
- a read-write service for the primary and a read-only service spread across the replicas
- keep a standby copy of our database in another Kubernetes cluster or cloud
- a PgBouncer connection pooler managed together with the database
- Prometheus metrics for every Postgres instance in the cluster
- move a database from a VM into Kubernetes with an online import over logical replication
- Postgres with pgvector for embeddings that keeps running when a node fails
Features
- automated failover and planned switchover
- synchronous and quorum-based replication
- backups and point-in-time recovery to object stores (Barman Cloud plugin) or volume snapshots
- replica clusters across Kubernetes clusters
- declarative roles, databases and extensions
- PgBouncer pooler
- rolling minor upgrades and offline major upgrades
- Prometheus metrics exporter
- cnpg kubectl plugin
- TLS and cert-manager integration
Capabilities
| Has an API | plan not known |
|---|---|
| Has a command line tool | plan not known |
| Takes plugins | plan not known |
Alternatives
The same job
These do what CloudNativePG does.
- KubeBlocks One open source operator for every database on Kubernetes
- Barman Cloud Plugin The reference CNPG-I backup/restore plugin for Barman Cloud
