Win $20,000. Help build the future of education. Answer the call. Learn more

Deploy a Crunchy PostgreSQL for Kubernetes Operator to an OpenShift cluster

Red Hat® OpenShift® 4 users can access certified software for container-based environments via the Red Hat Marketplace. Software in the marketplace is immediately available to deploy on any Red Hat OpenShift cluster in a fast, integrated way.

Follow the steps in this tutorial to set up and deploy a Crunchy PostgreSQL for Kubernetes operator hosted on Red Hat Marketplace. Crunchy PostgreSQL for Kubernetes offers an advanced integration with Kubernetes internals to enable hybrid cloud, infrastructure-agnostic PostgreSQL-as-a-Service.


  • Red Hat OpenShift version 4.3 is required to use with software in Red Hat Marketplace.
  • Create an account on Red Hat Marketplace.


  1. Configure a Red Hat OpenShift cluster on Red Hat Marketplace
  2. Install the Crunchy PostgreSQL for Kubernetes Operator
  3. Create and deploy a Crunchy PostgreSQL for Kubernetes Operator on an OpenShift cluster and create a database
  4. Access the cluster on your localhost

Step 1. Configure a Red Hat OpenShift cluster on Red Hat Marketplace

  1. Follow the steps in this tutorial to configure a Red Hat OpenShift cluster on Red Hat Marketplace

Step 2: Install the Crunchy PostgreSQL for Kubernetes Operator

  1. Go to the Red Hat Marketplace catalog, search for “Crunchy PostgreSQL for Kubernetes” and select the product from the results.

  2. The Crunchy PostgreSQL for Kubernetes product page gives you an overview, documentation, and pricing options associated with the product. Select the Free Trial button.

    Select the Free Trial button

  3. Next, the purchase summary will show the Subscription term, with a total cost of $0.00. Click Start trial.

    Start your free trial

    You can visit Workspace > My Software to view your list of purchased software.

  4. In the Red Hat Marketplace dashboard, select the Crunchy PostgreSQL for Kubernetes tile, and then click the Operators tab.

  5. Select the Install Operator button. Leave the default selection for Update channel and Approval strategy.

  6. Select the cluster and namespace scope as Crunchydb-test-project for the operator and click Install.

    Install the Crunchy PostgreSQL for Kubernetes operator

  7. You should see a message that indicates the install process initiated in the cluster.

Step 3: Create and deploy your operator on an OpenShift Cluster and create a database

  1. Use the new namespace where you installed the Crunchy PostgreSQL operator.

  2. Run the following command in your command line interface (CLI). Once it runs successfully, check the logs and be sure there are no errors in the Ansible logs. Wait for the pod state to change to Complete.

    NOTE: Download postgres-operator.yml from our GitHub repot.

    oc create -f postgres-operator.yml

  3. Switch to the Postgres Operator (pgo) namespace. pgo is a library used to connect to the OpenShift cluster.

  4. Edit pgo-config configmap and update DisableFSGroup to false.

  5. Restart the PostgreSQL operator pod. You can get the postgres pod name with the command oc get pods |grep postgres.

    NOTE: The reason we restart the PostgreSQL pod in step 5 is because Crunchy PostgreSQL for Kubernetes is set up to work with the restricted SCC by default, but we may need to make modifications. In this mode, you should ensure that DisableFSGroup is set to false. Changing the pgo-config ConfigMap requires the postgres-operator pod to restart.

  6. Download the pgo binary mentioned in the PostgreSQL Operator Quickstart guide.

    NOTE: We need to create a project that we can use and manage from the command line. Click on Create Project and supply a name such as Crunchydb-test-project

  7. Make sure the pvc are in a bound state. Run the following command:

    oc get pvc

    Results of the Get pvc command

  8. Create a database using the following command: pgo create cluster -n pgo hippo. This command creates a database (pods) in the pgo namespace.

  9. To validate that it worked correctly, run the following commands.

    • To validate the cluster: pgo show cluster -n pgo hippo
    • To validate the test: pgo test -n pgo hippo

Step 4: Access the cluster on your localhost

To view the results of the commands you ran in the earlier steps via the pgAdmin 4 console, Crunchy Data’s console. Access the console at localhost with port forwarding.

  1. Run the following command in your terminal:

     $ pgo create pgadmin hippo

    This creates a pgAdmin 4 deployment unique to this PostgreSQL cluster and synchronizes the PostgreSQL user information into it.

  2. To access pgAdmin 4, you can set up a port-forward to the service, which follows the pattern <clusterName>-pgadmin, to port 5050:

     $ kubectl port-forward -n pgo svc/hippo-pgadmin 5050:5050
     Forwarding from -> 5050
     Forwarding from [::1]:5050 -> 5050
  3. Open http://localhost:5050 on your browser and use your database username (e.g. hippo) and password (e.g. datalake) to log in.

    Log in screen to log in with your credentials

    Note: If your password doesn’t work, retry setting up the user with the pgo update user command: pgo update user -n pgo --username=hippo --password=datalake hippo.

Once logged in, you can see the pgAdmin 4 console as shown.

pgadmin 4 console of CrunchyDB