cloudnative-pg
The most popular Kubernetes Operator for PostgreSQL.
What is cloudnative-pg?
The most popular Kubernetes Operator for PostgreSQL.
Overview of cloudnative-pg
What it is
CloudNativePG (CNPG) is an open-source platform designed to manage PostgreSQL databases in Kubernetes environments. It covers the entire operational lifecycle from deployment to ongoing maintenance through its core component, the CloudNativePG operator. It is a Cloud Native Computing Foundation (CNCF) Sandbox project, originally built and sponsored by EDB.
Key features
- Direct integration with the Kubernetes API: PostgreSQL cluster status is available directly in the
Clusterresource, allowing inspection via the Kubernetes API. - Operator pattern: The operator automatically reconciles the desired PostgreSQL state following Kubernetes best practices.
- Immutable application containers: Updates follow an immutable infrastructure model.
- Automated failover management: If the primary instance fails, the operator elects a new primary, updates the cluster status, and orchestrates the transition.
- Scaling read replicas: When the number of desired replicas changes, the operator provisions or removes resources such as persistent volumes, secrets, and config maps while managing streaming replication.
- Rolling updates: When an image is updated, the operator follows a rolling strategy—first updating replica pods before performing a controlled switchover for the primary.
- Manages additional Kubernetes resources:
Backup,ClusterImageCatalog,Database,ImageCatalog,Pooler,Publication,ScheduledBackup, andSubscription.
Use cases
- Running PostgreSQL in Kubernetes with a Kubernetes-native approach to primary/standby cluster management.
- Automating database operations that a skilled DBA would perform manually, such as failover, scaling, and rolling updates.
- Integrating PostgreSQL into GitOps-driven CI/CD automation and development processes.
- Managing PostgreSQL clusters without relying on external high-availability tools like Patroni, repmgr, or Stolon.
Getting started
See the repository README for installation instructions.
License and pricing
License: Apache-2.0. Pricing: open source (free).
Based on the project's public README and repository metadata.