Cloud Native PostgreSQL: An Operator to run full featured PostgreSQL in Kubernetes
Introduction
CloudNativePG is the Kubernetes operator that covers the full lifecycle of a highly available PostgreSQL database cluster with a primary/standby architecture, using native streaming replication.
Installation
To install the CloudNativePG operator, you can use the helm chart:
Configuration
The CloudNativePG operator can be configured using the following parameters:
Deploy a cluster
First of all, set the login/password of the superuser. Let's define a secret for this:
As you can see, the password and username are base64 encoded. You can use the following command to encode them:
And then set the cluster configuration with MetalLB service:
Then, deploy the cluster and the secret:
You can validate the deployment pods and services this way:
As you can see, multiple services:
pg-cluster-r
: Points to any PostgreSQL instance in the cluster (read).pg-cluster-ro
Points to the replicas, where available (read-only).pg-cluster-rw
Points to the primary instance of the cluster (read/write).pg-cluster-rw-lb
is the load balancer service we've set earlier