Seamless pgAdmin 4 Deployments Using PGO v5.1

Avatar for Andrew L'Ecuyer

Andrew L'Ecuyer

3 min read

Recently, there has been a bit of a debate here at Crunchy Data around SQL editors. While some members of the Crunchy Team such as Elizabeth (@e_g_christensen) prefer pgAdmin 4, others such as Craig (@craigkerstiens) prefer using psql. And one the great things about the PostgreSQL ecosystem is that there is no right answer to this debate! Instead, you have choice and flexibility when it comes to finding and using the tools that meet your specific database development and/or management needs.

With the release of PGO v5.1 we're excited to announce support for pgAdmin 4. We're bringing yet another choice for developing and managing your PostgreSQL databases to PGO. So for those that have been wanting support for an GUI-based SQL editor, we've now made it dead simple to add one to any PGO-provisioned PostgreSQL cluster. By defining the following in your PostgresCluster spec, not only will PGO provision a pgAdmin 4 deployment and PostgreSQL user account named rhino, it will also automatically create a pgAdmin 4 user account called rhino@pgo:

spec:
  users:
  - name: rhino
  userInterface:
    pgAdmin:
      image: registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-0
      dataVolumeClaimSpec:
        accessModes:
        - "ReadWriteOnce"
        resources:
          requests:
            storage: 1Gi

For instance, with the above spec applied, a Deployment will be reconciled by PGO in order to deploy pgAdmin 4:

$ kubectl get pods --selector postgres-operator.crunchydata.com/role=pgadmin
NAME       READY  STATUS  RESTARTS  AGE
hippo-pgadmin-0  1/1   Running  0     48s

Additionally, the Secret containing the credentials for rhino can be used to access both the PostgreSQL database itself and pgAdmin 4. For instance, the password shown below for the hippo-pguser-rhino Secret (which must be decoded) will allow a user named rhino to access both:

$ kubectl get secret hippo-pguser-rhino -o yaml | grep password
password: bkBBSDVSN15sRURGZGo4LXNTdGd0W30v

To connect to pgAdmin 4, you can the port-forward to the pgAdmin 4 Service, and then navigate to http://localhost:5050 in a browser (a spec.userInterface.pgAdmin.service.type setting is also available to configure the Service according to your specific needs):

$ kubectl port-forward svc/hippo-pgadmin 5050:5050
Forwarding from 127.0.0.1:5050 -> 5050

pgAdmin login screen

Please note that each PostgresCluster is assigned its own pgAdmin 4 deployment. Therefore, to deploy pgAdmin 4 for any other PostgreSQL clusters in your environment, simply update the PostgresCluster spec in the same way as the hippo spec above.

As you can see, not only does PGO v5.1 now provide a powerful PostgreSQL GUI in the form of pgAdmin 4, it also allows you to easily manage user accounts across both PostgreSQL and pgAdmin 4.

Managing PostgreSQL Your Way

With a simple update to your PostgresCluster spec you can have a pgAdmin 4 deployment fully up-and-running in no time. Not only that, but the deployment seamlessly integrates with the robust user management capabilities already included in PGO. In fact, when we recently showed off this new feature, many of the reactions were: "That's it? I don't have to do anything else to get it running?".

We are therefore excited to provide yet another choice for developing and managing your PostgreSQL databases in PGO v5.1. And not to be one-upped by Crunchy Bridge, who recently rolled out with support for pgAdmin 4 as part of the Postgres Container Apps feature, we felt that it was important to also bring this powerful capability to PGO!

Thank you for taking the time to see just how easy PGO makes configuring and deploying pgAdmin 4. For a full list of all features and changes included in PGO v5.1, please see the full release notes. If you are just getting started with PGO for the first time, please see the quickstart.