Basic Setup

Setting up your environment

The first thing that you will need is a Kubernetes or Openshift environment running a supported version. You can see all of the versions in our documentation. You can deploy to your environment locally, in the cloud, or even run it via a managed Kubernetes offering.

You will also need to insure that you have a modern version of git installed locally, as well as kubectl installed and configured on your local workstation. You can install those from your OS's package manager. You can refer to the reference for git if you are not already familiar with it, or you need to install it by hand. You can also visit the kubectl reference for more information about how to install and use this tool.

Once you have your tools and environment set up, we can move on to installing Crunchy Postgres for Kubernetes.

Download the Examples

First, go to GitHub and fork the Postgres Operator examples repository:

Once you have forked this repository, you can download it to your working directory with a command similar to this:

cd <Your Working Directory>
git clone --depth 1 "${YOUR_GITHUB_UN}/postgres-operator-examples.git"

With the examples repo cloned into your working directory, navigate (for example, cd postgres-operator-examples) to the top level folder of the repo. If you use ls -lah it should look something like this:

~/Code/Crunchy/postgres-operator-examples ☯ ls -lah
total 32
drwxr-xr-x   8 hippo  staff   256B May 22 14:27 .
drwxr-xr-x   9 hippo  staff   288B Jun 29 13:59 ..
drwxr-xr-x  14 hippo  staff   448B May  9 12:00 .git
drwxr-xr-x   3 hippo  staff    96B Jul 19  2022 .github
-rw-r--r--   1 hippo  staff    11K Apr  3 12:17
-rw-r--r--@  1 hippo  staff   1.1K May  9 11:27
drwxr-xr-x   4 hippo  staff   128B Jul 19  2022 helm
drwxr-xr-x  12 hippo  staff   384B Jul 19  2022 kustomize

Once you have your local environment set up, we can press onwards to installing Crunchy Postgres for Kubernetes...

Install Crunchy Postgres for Kubernetes

Our next task is to install Crunchy Postgres for Kubernetes into a namespace in Kubernetes. This example uses a default namespace of postgres-operator. However, you can install it in other namespaces or even cluster wide if you need. You can read more about that in our advanced install guides.

First, we need to set up the namespace that we are going to use. Use this command to create the default namespace:

kubectl apply -k kustomize/install/namespace

Next, you will need to install the various containers and configuration that makes up Crunchy Postgres for Kubernetes. Here is the command to do that:

kubectl apply --server-side -k kustomize/install/default

To check on the status of your installation, you can run the following command:

kubectl -n postgres-operator get pods \ \

If the PGO Pod is healthy, you should see output similar to:

NAME                                READY   STATUS    RESTARTS   AGE
postgres-operator-9dd545d64-t4h8d   1/1     Running   0          3s

Now that we have installed all of the supporting containers and configuration, it's time to roll our sleeves up and set up a Postgres cluster...