Skip to main content
PGO supports two distinct upgrade paths: minor version updates and major version upgrades. Minor updates swap the container image and trigger a rolling restart, keeping the cluster online throughout. Major upgrades require the PGUpgrade custom resource, which runs pg_upgrade to migrate data from one major version to the next.

Minor version updates

PostgreSQL releases minor versions frequently to deliver bug fixes and security patches. To apply a minor update, change the image field in your PostgresCluster spec to reference the newer image tag.
Apply the change:
PGO detects the image change and performs a rolling restart of the instance pods. The primary is restarted last, so the cluster remains available throughout the update as long as you have at least one replica. When image is omitted from the spec, the operator uses an environment variable to look up the image. For a standard PostgreSQL 16 cluster, it reads RELATED_IMAGE_POSTGRES_16. You can update the image by changing this variable in the operator deployment instead of modifying individual cluster specs.
If you use a PostGIS-enabled image, the environment variable follows the pattern RELATED_IMAGE_POSTGRES_{version}_GIS_{postGISVersion}, for example RELATED_IMAGE_POSTGRES_16_GIS_3.4.

Major version upgrades

A major PostgreSQL upgrade—for example, from PostgreSQL 15 to 16—requires migrating the on-disk data format. PGO uses the PGUpgrade custom resource to orchestrate this process via the pg_upgrade tool.
The cluster must be shut down before running a major upgrade. The PGUpgrade resource does not perform a live upgrade. Plan for a maintenance window.

Step-by-step major upgrade

1

Shut down the PostgresCluster

Set spec.shutdown: true on your cluster to stop all workloads. Volumes and Services remain in place.
Confirm all pods have terminated:
2

Create the PGUpgrade resource

Create a PGUpgrade manifest that references your cluster by name and specifies the source and target versions.
Apply it:
PGO creates a pod that runs pg_upgrade against the cluster’s data directory.
3

Monitor upgrade progress

Watch the PGUpgrade status conditions to track progress:
The upgrade is complete when the Succeeded condition is true.
4

Update the PostgresCluster spec

After the upgrade job completes, update your cluster spec to reflect the new major version and the corresponding image. Set shutdown: false to restart the cluster.
Apply the change:
5

Verify the upgraded cluster

Confirm PostgreSQL is running on the new version:

PGUpgrade spec reference

The full PGUpgradeSpec fields are:
PGUpgradeCPUConcurrency is a beta feature gate (enabled by default) that automatically adjusts the jobs parallelism based on available CPU resources on the upgrade pod. See Feature Gates.

Next steps

Resize cluster resources

Scale storage and compute after upgrading your cluster.

PGUpgrade reference

Full API reference for the PGUpgrade custom resource.