Skip to main content
The PGUpgrade custom resource drives major PostgreSQL version upgrades for clusters managed by PGO. It runs pg_upgrade in a Kubernetes Job, converting the cluster’s data files from one major PostgreSQL version to another. You create a PGUpgrade, wait for it to complete, and then resume your PostgresCluster running the new version. API group: postgres-operator.crunchydata.com/v1beta1 Kind: PGUpgrade Scope: Namespaced

Upgrade workflow

Performing a major PostgreSQL version upgrade requires coordinating the PGUpgrade resource with your PostgresCluster. Follow these steps:
1

Pause the PostgresCluster

Set spec.paused: true on your PostgresCluster to stop reconciliation while the upgrade runs.
2

Create the PGUpgrade resource

Apply a PGUpgrade manifest targeting your cluster. The fromPostgresVersion must match the cluster’s current version and toPostgresVersion must be a higher major version.
3

Wait for the upgrade Job to complete

Monitor the PGUpgrade status conditions until Succeeded becomes True.
4

Update the PostgresCluster version and resume

Update spec.postgresVersion on your PostgresCluster to the new version and clear the paused flag.
5

Delete the PGUpgrade resource

Once the cluster is running successfully on the new version, delete the PGUpgrade resource.
Major version upgrades cannot be reversed. Take a full pgBackRest backup before starting the upgrade and verify it is accessible. See the backups guide.

Example


Spec fields

string
required
The name of the PostgresCluster to upgrade. The cluster must exist in the same namespace as this PGUpgrade.
integer
required
The major PostgreSQL version of the cluster before the upgrade. Must be less than toPostgresVersion. Accepted values: 11–18.
integer
required
The major PostgreSQL version to upgrade to. Must be greater than fromPostgresVersion. Accepted values: 11–18.
integer
Number of simultaneous pg_upgrade worker processes. Higher values can speed up the upgrade on multi-core nodes. Minimum: 0 (uses pg_upgrade default).
string
The method pg_upgrade uses to transfer data files to the new cluster. Available methods depend on the PostgreSQL version being upgraded to.When not specified, pg_upgrade selects its default for the target version.
string
Container image for the pg_upgrade tool. When omitted, the operator resolves the image from its environment configuration.
string
Image pull policy for the upgrade container. One of: Always, Never, IfNotPresent.
[]LocalObjectReference
Image pull secrets for pulling the upgrade image from a private registry. Changing this value causes all running PGUpgrade pods to restart.
ResourceRequirements
Compute resource requests and limits for the pg_upgrade container.
Affinity
Kubernetes affinity rules for scheduling the upgrade pod. Useful for placing the upgrade Job on nodes with sufficient resources or specific storage access.
[]Toleration
Tolerations for scheduling the upgrade pod onto tainted nodes.
string
Priority class name for the upgrade pod. Changing this value causes the pod to restart.
Metadata
Labels and annotations to apply to the upgrade Job and pod.

Status fields

Monitor upgrade progress with: