About this project

CloudNativePG (CNPG) is an open-source operator that runs and manages PostgreSQL databases on Kubernetes, covering the entire operational lifecycle from initial deployment through ongoing maintenance. It is a Cloud Native Computing Foundation (CNCF) Sandbox project, originally built and sponsored by EDB, and released under the Apache-2.0 license. Rather than depending on external high-availability tools such as Patroni, repmgr, or Stolon, the operator integrates directly with the Kubernetes API and follows the standard operator pattern: the desired state of a PostgreSQL cluster is declared in a Cluster custom resource, and the controller continuously reconciles actual state against it. The cluster's status is exposed through that same resource, so it can be inspected with ordinary Kubernetes tooling. Application containers follow an immutable infrastructure model, with updates applied by replacing rather than patching containers. Automated operations include: - Failover management: when the primary instance fails, the operator elects a new primary, updates the cluster status, and orchestrates the transition. - Read replica scaling: changing the desired replica count provisions or removes persistent volumes, secrets, and config maps while managing streaming replication. - Service updates: Kubernetes remains the single source of truth, keeping PostgreSQL service endpoints up to date. - Rolling updates: image updates roll out to replica pods first, followed by a controlled switchover of the primary. Beyond the Cluster resource, the operator manages additional Kubernetes resources including Backup, ScheduledBackup, Database, Pooler, Publication, Subscription, ImageCatalog, and ClusterImageCatalog, supporting declarative backup scheduling, connection pooling, logical replication objects, and image catalogs. The project's scope is deliberately narrow: it targets vanilla Kubernetes and vanilla PostgreSQL only, does not support other databases (such as MariaDB) or PostgreSQL forks (fork features are only considered if integrable as extensions or pluggable frameworks), and can be extended through the CNPG-I plugin interface. Its stated mission is to increase PostgreSQL adoption in Kubernetes by making it part of development processes and GitOps-driven CI/CD automation. The project publishes a quickstart guide, full documentation, a roadmap, an FAQ, and a blog; it holds open community meetings, maintains a public list of adopters, and offers commercial support options. It has been presented at multiple KubeCon events on topics including disaster recovery for very large databases, vertical scalability with Kubernetes storage, quorum-based consistency during cluster changes, and near-zero-downtime database migrations.