MCPcopy Index your code
hub / github.com/CrunchyData/postgres-operator

github.com/CrunchyData/postgres-operator @v6.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v6.0.2 ↗ · + Follow
1,679 symbols 9,318 edges 289 files 1,085 documented · 65% 52 cross-repo links updated todayv6.0.2 · 2026-06-02★ 4,429147 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PGO: The Postgres Operator from Crunchy Data

PGO: The Postgres Operator from Crunchy Data

Go Report Card GitHub Repo stars License Discord

Production Postgres Made Easy

PGO, the Postgres Operator from Crunchy Data, gives you a declarative Postgres solution that automatically manages your PostgreSQL clusters.

Designed for your GitOps workflows, it is easy to get started with Postgres on Kubernetes with PGO. Within a few moments, you can have a production-grade Postgres cluster complete with high availability, disaster recovery, and monitoring, all over secure TLS communications. Even better, PGO lets you easily customize your Postgres cluster to tailor it to your workload!

With conveniences like cloning Postgres clusters to using rolling updates to roll out disruptive changes with minimal downtime, PGO is ready to support your Postgres data at every stage of your release pipeline. Built for resiliency and uptime, PGO will keep your Postgres cluster in its desired state, so you do not need to worry about it.

PGO is developed with many years of production experience in automating Postgres management on Kubernetes, providing a seamless cloud native Postgres solution to keep your data always available.

Have questions or looking for help? Join our Discord group.

Build Instructions

To build the various containers required by PGO, please see the build instructions found in the components directory of this repository. These images are built using packages developed by the PostgreSQL Global Development Group (PGDG). Each subdirectory contains a README file describing how to build each of the various containers required by PGO.

Installation

Crunchy Data makes PGO available as the orchestration behind Crunchy Postgres for Kubernetes. Crunchy Postgres for Kubernetes is the integrated product that includes PostgreSQL, PGO and a collection of PostgreSQL tools and extensions that includes the various open source components listed in the documentation.

We recommend following our Quickstart for how to install and get up and running. However, if you can't wait to try it out, here are some instructions to get Postgres up and running on Kubernetes:

  1. Fork the Postgres Operator examples repository and clone it to your host machine. For example:
YOUR_GITHUB_UN="<your GitHub username>"
git clone --depth 1 "git@github.com:${YOUR_GITHUB_UN}/postgres-operator-examples.git"
cd postgres-operator-examples
  1. Run the following commands
kubectl apply -k kustomize/install/namespace
kubectl apply --server-side -k kustomize/install/default

For more information please read the Quickstart and Tutorial.

These installation instructions provide the steps necessary to install PGO along with Crunchy Data's Postgres distribution, Crunchy Postgres, as Crunchy Postgres for Kubernetes. In doing so the installation downloads a series of container images from Crunchy Data's Developer Portal. For more information on the use of container images downloaded from the Crunchy Data Developer Portal or other third party sources, please see 'License and Terms' below. The installation and use of PGO outside of the use of Crunchy Postgres for Kubernetes will require modifications of these installation instructions and creation of the necessary PostgreSQL and related containers.

Cloud Native Postgres for Kubernetes

PGO, the Postgres Operator from Crunchy Data, comes with all of the features you need for a complete cloud native Postgres experience on Kubernetes!

PostgreSQL Cluster Provisioning

Create, Scale, & Delete PostgreSQL clusters with ease, while fully customizing your Pods and PostgreSQL configuration!

High Availability

Safe, automated failover backed by a distributed consensus high availability solution. Uses Pod Anti-Affinity to help resiliency; you can configure how aggressive this can be! Failed primaries automatically heal, allowing for faster recovery time.

Support for standby PostgreSQL clusters that work both within and across multiple Kubernetes clusters.

Disaster Recovery

Backups and restores leverage the open source pgBackRest utility and includes support for full, incremental, and differential backups as well as efficient delta restores. Set how long you to retain your backups. Works great with very large databases!

Security and TLS

PGO enforces that all connections are over TLS. You can also bring your own TLS infrastructure if you do not want to use the defaults provided by PGO.

PGO runs containers with locked-down settings and provides Postgres credentials in a secure, convenient way for connecting your applications to your data.

Monitoring

Track the health of your PostgreSQL clusters using the open source pgMonitor library.

Upgrade Management

Safely apply PostgreSQL updates with minimal impact to the availability of your PostgreSQL clusters.

Advanced Replication Support

Choose between asynchronous and synchronous replication for workloads that are sensitive to losing transactions.

Clone

Create new clusters from your existing clusters or backups with efficient data cloning.

Connection Pooling

Advanced connection pooling support using pgBouncer.

Pod Anti-Affinity, Node Affinity, Pod Tolerations

Have your PostgreSQL clusters deployed to Kubernetes Nodes of your preference. Set your pod anti-affinity, node affinity, Pod tolerations, and more rules to customize your deployment topology!

Scheduled Backups

Choose the type of backup (full, incremental, differential) and how frequently you want it to occur on each PostgreSQL cluster.

Backup to Local Storage, S3, GCS, Azure, or a Combo!

Store your backups in Amazon S3 or any object storage system that supports the S3 protocol. You can also store backups in Google Cloud Storage and Azure Blob Storage.

You can also mix-and-match: PGO lets you store backups in multiple locations.

Full Customizability

PGO makes it easy to fully customize your Postgres cluster to tailor to your workload:

Namespaces

Deploy PGO to watch Postgres clusters in all of your namespaces, or restrict which namespaces you want PGO to manage Postgres clusters in!

Included Components

PostgreSQL containers deployed with the PostgreSQL Operator include the following components:

In addition to the above, the geospatially enhanced PostgreSQL + PostGIS container adds the following components:

PostgreSQL Operator Monitoring uses the following components:

For more information about which versions of the PostgreSQL Operator include which components, please visit the compatibility section of the documentation.

Supported Platforms

PGO, the Postgres Operator from Crunchy Data, is tested on the following platforms:

  • Kubernetes
  • OpenShift
  • Rancher
  • Google Kubernetes Engine (GKE), including Anthos
  • Amazon EKS
  • Microsoft AKS
  • VMware Tanzu

Contributing to the Project

Want to contribute to the PostgreSQL Operator project? Great! We'v

Extension points exported contracts — how you extend this code

PostgresPassword (Interface)
PostgresPassword is the interface that defines the methods required to build a password for PostgreSQL in a desired form [2 …
internal/postgres/password/password.go
Gate (Interface)
Gate indicates what features exist and which are enabled. [1 implementers]
internal/feature/features.go
ClientGet (FuncType)
Types that implement single methods of the [client.Reader] interface.
internal/controller/runtime/client.go
API (Interface)
API defines a general interface for interacting with the Patroni API.
internal/patroni/api.go
Executor (FuncType)
Executor calls "pgbackrest" commands
internal/pgbackrest/pgbackrest.go
APIs (Interface)
(no doc) [1 implementers]
internal/kubernetes/apis.go
Executor (FuncType)
(no doc)
internal/pgadmin/users.go
CrunchyCRD (Interface)
(no doc)
internal/collector/util.go

Core symbols most depended-on inside this repo

Equal
called by 1106
internal/pki/pki.go
Create
called by 224
internal/controller/runtime/client.go
MarshalMatches
called by 173
internal/testing/cmp/cmp.go
DeepCopy
called by 166
internal/postgres/parameters.go
Merge
called by 131
internal/naming/labels.go
UnmarshalInto
called by 129
internal/testing/require/encoding.go
Get
called by 122
internal/controller/runtime/client.go
Equal
called by 121
internal/postgres/parameters.go

Shape

Function 893
Method 588
Struct 161
FuncType 17
TypeAlias 13
Interface 7

Languages

Go100%

Modules by API surface

pkg/apis/postgres-operator.crunchydata.com/v1beta1/zz_generated.deepcopy.go198 symbols
pkg/apis/postgres-operator.crunchydata.com/v1/zz_generated.deepcopy.go52 symbols
internal/naming/names.go43 symbols
internal/controller/postgrescluster/pgbackrest.go39 symbols
internal/controller/postgrescluster/instance.go33 symbols
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go30 symbols
pkg/apis/postgres-operator.crunchydata.com/v1/postgrescluster_types.go29 symbols
internal/postgres/hba.go28 symbols
pkg/apis/postgres-operator.crunchydata.com/v1beta1/shared_types.go25 symbols
internal/controller/postgrescluster/pgbackrest_test.go23 symbols
internal/naming/labels.go21 symbols
internal/controller/runtime/client.go21 symbols

Dependencies from manifests, versioned

cel.dev/exprv0.25.1 · 1×
github.com/antlr4-go/antlr/v4v4.13.0 · 1×
github.com/beorn7/perksv1.0.1 · 1×
github.com/davecgh/go-spewv1.1.2-0.20180830191 · 1×

For agents

$ claude mcp add postgres-operator \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact