CloudNativePG (CNPG) is an open-source platform designed to seamlessly
manage PostgreSQL databases in Kubernetes
environments. It covers the entire operational lifecycle—from deployment to
ongoing maintenance—through its core component, the CloudNativePG operator.
CloudNativePG aims to increase PostgreSQL adoption within Kubernetes by making
it an integral part of the development process and GitOps-driven CI/CD
automation.
Core Principles & Features
Designed by PostgreSQL experts for Kubernetes administrators, CloudNativePG
follows a Kubernetes-native approach to PostgreSQL primary/standby cluster
management. Instead of relying on external high-availability tools (like
Patroni, repmgr, or Stolon), it integrates directly with the Kubernetes API to
automate database operations that a skilled DBA would perform manually.
Key design decisions include:
Direct integration with Kubernetes API: The PostgreSQL cluster’s status is
available directly in the Cluster resource, allowing users to inspect it
via the Kubernetes API.
Operator pattern: The operator ensures that the desired PostgreSQL state is
reconciled automatically, following Kubernetes best practices.
The operator continuously monitors and updates the PostgreSQL cluster state.
Examples of automated actions include:
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.
Service updates: Kubernetes remains the single source of truth, ensuring
that PostgreSQL service endpoints are always up to date.
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.
CloudNativePG manages additional Kubernetes resources to enhance PostgreSQL
management, including: Backup, ClusterImageCatalog, Database,
ImageCatalog, Pooler, Publication, ScheduledBackup, and Subscription.
A list of publicly known users of the CloudNativePG operator is in ADOPTERS.md.
Help us grow our community and CloudNativePG by adding yourself and your
organization to this list!
CloudNativePG was originally built and sponsored by EDB.
Postgres, PostgreSQL, and the Slonik Logo
are trademarks or registered trademarks of the PostgreSQL Community Association
of Canada, and used with their permission.