Don't want to install anything locally just yet? Try a demonstration directly in your browser:
RedHat OpenShift Container Platform users can test the certified operator for Cloud Native PostgreSQL on the Red Hat CodeReady Containers (CRC) for OpenShift.
The instructions contained in this section are for demonstration, testing, and practice purposes only and must not be used in production.
Like any other Kubernetes application, Cloud Native PostgreSQL is deployed using regular manifests written in YAML.
By following the instructions on this page you should be able to start a PostgreSQL cluster on your local Kubernetes/Openshift installation and experiment with it.
If you are running Openshift, use
oc every time
kubectl is mentioned
in this documentation.
kubectl commands are compatible with
The first part is about installing Minikube, Kind, or CRC. Please spend some time reading about the systems and decide which one to proceed with. After setting up one of them, please proceed with part 2.
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day. Normally, it is used in conjunction with VirtualBox.
You can find more information in the official Kubernetes documentation on how to install Minikube in your local personal environment. When you installed it, run the following command to create a minikube cluster:
This will create the Kubernetes cluster, and you will be ready to use it. Verify that it works with the following command:
You will see one node called
If you do not want to use a virtual machine hypervisor, then Kind is a tool for running local Kubernetes clusters using Docker container "nodes" (Kind stands for "Kubernetes IN Docker" indeed).
kind on your environment following the instructions in the Quickstart,
then create a Kubernetes cluster with:
Download RedHat CRC
and move the binary inside a directory in your
You can then run the following commands:
crc start output will explain how to proceed. You'll then need to
execute the output of the
crc oc-env command.
After that, you can log in as
kubeadmin with the printed
command. You can also open the web console running
User and password are the same as for the
oc login command.
CRC doesn't come with a StorageClass, so one has to be configured.
You can follow the Dynamic volume provisioning wiki page
Now that you have a Kubernetes or OpenShift installation up and running on your laptop, you can proceed with Cloud Native PostgreSQL installation.
Please refer to the "Installation" section and then proceed with the deployment of a PostgreSQL cluster.
As with any other deployment in Kubernetes, to deploy a PostgreSQL cluster
you need to apply a configuration file that defines your desired
cluster-example.yaml sample file
defines a simple
Cluster using the default storage class to allocate
For more detailed information about the available options, please refer to the "API Reference" section.
In order to create the 3-node PostgreSQL cluster, you need to run the following command:
You can check that the pods are being created with the
get pods command:
By default, the operator will install the latest available minor version
of the latest major version of PostgreSQL when the operator was released.
You can override this by setting the
imageName key in the
spec section of
Cluster definition. For example, to install PostgreSQL 12.5:
The immutable infrastructure paradigm requires that you always
point to a specific version of the container image.
Never use tags like
13 in a production environment
as it might lead to unpredictable scenarios in terms of update
policies and version consistency in the cluster.