PGO Version 5.1 Release Comes With Powerful New Capabilities

Andrew L'Ecuyer

4 min read

A colleague of mine recently tweeted the following, highlighting the challenges often associated with database upgrades:

Last week had 3 calls before noon of people having difficulty with database upgrades and connection scaling.

Two things that should be staples for a database provider and they had no idea until 6 months in when they tried to upgrade.

As an industry we can build better.

— Craig Kerstiens (@craigkerstiens) March 28, 2022

When I saw that tweet, I couldn’t help but appreciate the timing considering the PGO v5.1 release was right on the horizon. Whether upgrading PGO, or upgrading your database to a new major version of PostgreSQL, PGO v5.1 makes upgrading easier than ever before. PGO v5.1 delivers on what it means to be a production-ready Postgres database you can run inside Kubernetes.

We're excited to announce the general availability of version 5.1 of PGO, the open source Postgres Operator from Crunchy Data. In addition to providing a seamless upgrade experience across both PGO and PostgreSQL versions, this feature-packed release also introduces many powerful new capabilities.  This includes:

  • Native integration of a PostgreSQL GUI
  • Automated rollouts of all PostgreSQL configuration changes
  • Strategies for protecting against cluster disruptions
  • Enhancements to both High Availability and Disaster Recovery architectures
  • And much, much more!

While upcoming posts will highlight some of these new great features in further detail, this post will focus on upgrading PGO itself. Let’s take a look at how easy it is to upgrade to PGO v5.1!

Preparing to Upgrade to PGO v5.1

Two different strategies are available for defining the images PGO should use when creating a new PostgreSQL cluster:

  • Defining image fields in the PostgresCluster spec.
  • By defining related image environment variables in the PGO Deployment. Please see the PostgresCluster CRD reference for more details.

If you are using related images, then no further steps are required to prepare for the upgrade and you can jump ahead to the upgrading to PGO v5.1 section below. This is because PGO itself will handle the image tag updates for all managed PostgreSQL clusters, safely rolling out the new PGO v5.1 images.

If you are not using related images, then an extra step is required before upgrading PGO. You will need to update both the PostgreSQL and pgBackRest images to the latest versions available for PGO v5.1. Doing so will ensure your cluster is using pgBackRest v2.38, which supports mTLS as needed for a seamless PGO v5.1 upgrade.

So before moving onto the next step, first update all spec.image and spec.backups.pgbackrest.image fields to the latest images available for PGO v5.1. These images are compatible with versions of PGO v5 before v5.1 and will safely roll out to your PostgreSQL clusters. Please see the Components and Compatibility documentation for more information.

For instance, you can patch an existing PostgreSQL 13 cluster called hippo as follows:

$ kubectl patch postgrescluster hippo --type "json" -p '\[
 {"op":"replace", "path":"/spec/image", "value":

"registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-13.6-1"},
 {"op":"replace", "path":"/spec/backups/pgbackrest/image", "value":

"registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.38-0"}
\]
'
postgrescluster.postgres-operator.crunchydata.com/hippo patched

Once you have updated the images for all existing clusters, you can then move onto the next section.

Note: PGO attempts to reduce the number of prerequisites required when upgrading to the fullest extent possible (i.e., regardless of how images are defined, etc.).  Yet in certain scenarios, such as when there are major architecture changes, more steps might be required. Be sure to check the upgrade documentation for any steps required when upgrading.

Upgrading to PGO v5.1

Upgrading PGO to v5.1 is as simple as applying the latest Kustomize installer, or upgrading to the latest version of the PGO Helm chart.  Once the upgrade of the PGO deployment is complete, PGO will then upgrade all managed PostgreSQL clusters.  For more information about installing and upgrading PGO, please see the installation documentation.

Kustomize

If PGO is targeting all namespaces, you would upgrade via Kustomize as follows:

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

Or if targeting a single namespace, run the following:

kubectl apply --server-side --force-conflicts -k
kustomize/install/singlenamespace

Helm

If using Helm, you can upgrade via the latest version of the PGO Helm chart using the helm upgrade command.  However, you will first need to update the CRDs using kubectl and server-side apply:

kubectl apply --server-side --force-conflicts -f helm/install/crds

helm upgrade pgo -n postgres-operator helm/install

More Than Just Upgrades

And with that, the PGO v5.1 upgrade is complete! At the end of the day, a production-ready PostgreSQL architecture should include:

  • Simple provisioning
  • High Availability (HA)
  • Disaster Recovery (DR)
  • Monitoring
  • Connection scaling
  • Seamless upgrades

As you can see above, PGO v5.1 makes the operator upgrade experience easier than ever before. By streamlining the upgrade process, you can now easily move to the new versions of PGO. This will ensure you always have the latest features at your disposal for managing your production PostgreSQL databases.

For a full list of all features and changes included in PGO v5.1, please see the full release notes. For more information about installing and upgrading PGO, please see the Installation documentation.

Avatar for Andrew L'Ecuyer

Written by

Andrew L'Ecuyer

April 22, 2022 More by this author