This topic provides steps to upgrade the VMware Postgres Operator and VMware Postgres Operator instances to a newer version. Upgrading the Postgres Operator also upgrades the existing Postgres instances. The topic covers three upgrade scenarios:
C
or POSIX
need to be reindexed. Review the following steps to avoid issues with data consistency:
postgres
and pgConfig.dbname
, without explicitly set GRANT
privileges, will lose the default CREATE
and USAGE
privileges on the schema public
, and lose CONNECT
privileges on the postgres
, and pgConfig.dbname
databases. To avoid any upgrade issues, check all manually created roles and update their privileges. For example: - Use the psql query /du
to check if you have any manually created roles on postgres
and pgConfig.dbname
databases, other than the spec.pgConfig.username
and spec.pgConfig.appUser
. - Run GRANT statements for roles that need these permissions before upgrading the Operator. For details on GRANT
queries, refer to [GRANT] (https://www.postgresql.org/docs/current/sql-grant.html) in the PostgreSQL documentation.standard
storage class to the default storage class. Users should update their instance manifests to explicitly specify standard
, if that's the storage class used by their PVCs. See release 1.9.0 Release Notes.spec.postgresVersion.name
to postgres-15
. If you are tracking manifest files in source control, update those manifests files to reflect the change. Note that existing Postgres instances cannot be upgraded to a different major version.Ensure you have access to Broadcom Support and Tanzu Network Registry. You can use the same credentials for both sites.
Note: Use Helm CLI 3.8.0 and later.
Access the resources using two different methods:
Use Setup VMware Postgres Operator via Tanzu Network Registry for a faster installation process, and if your server hosts have access to the internet.
Use Setup VMware Postgres Operator via Downloadable Archive File if your server hosts do not have access to the internet, or if you want to install from a private registry.
Use Helm to log in to the Tanzu Network Registry, using your credentials:
helm registry login tanzu-sql-postgres.packages.broadcom.com \
--username=<USERNAME> \
--password=<PASSWORD>
Follow the prompts to enter the email address and password for your Tanzu Network account.
Download the Helm chart from the Tanzu distribution registry, and export it into a local /tmp/
directory:
helm pull oci://tanzu-sql-postgres.packages.broadcom.com/vmware-sql-postgres-operator --version v3.0.0 --untar --untardir /tmp
Follow the steps in Upgrading the Operator.
Choose this method if the installation destination (for example an air-gapped network) cannot access the VMware Tanzu Network, or you wish to load the Operator and instance images to private Docker registry.
Download the latest VMware Postgres Operator version from VMware Tanzu Network. The VMware Postgres Operator download filename has the format: postgres-for-kubernetes-v<version>.tar.gz
.
Load the new Postgres Operator and Postgres instances images into your container registry following the steps in Setup the VMware Postgres Operator via a Downloaded Archive File.
Navigate to where you have downloaded the helm chart:
cd /directory/with/helm-chart
Update the existing instance of Postgres Custom Resource Definition (CRD) with the new values:
kubectl apply -f crds/
Create an operator-overrides.yaml
file at a location of your choice or update an existing overrides file.
Replace the sample parameters for operatorImage
, postgresImage
, dockerRegistrySecretName
, certManagerClusterIssuerName
, and resources
with your values.
# specify the url for the docker image for the operator, e.g. gcr.io/<my_project>/postgres-operator
operatorImage: tanzu-sql-postgres.packages.broadcom.com/postgres-operator:v3.0.0
# specify the docker image for postgres instance, e.g. gcr.io/<my_project>/postgres-instance
postgresImage: tanzu-sql-postgres.packages.broadcom.com/postgres-instance:v3.9.0
# specify the name of the docker-registry secret to allow the cluster to authenticate with the container registry for pulling images
dockerRegistrySecretName: regsecret
# override the default self-signed cert-manager cluster issuer
certManagerClusterIssuerName: postgres-operator-ca-certificate-cluster-issuer
# set the resources for the postgres operator deployment
resources: {}
# limits:
# cpu: 500m
# memory: 300Mi
# requests:
# cpu: 500m
# memory: 300Mi
Target the namespace where you have installed the helm release.
kubectl config set-context --current --namespace=<POSTGRES-OPERATOR-NAMESPACE>
where POSTGRES-OPERATOR-NAMESPACE
is the namespace.
List the helm releases using:
helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
postgres-operator default 3 2022-01-06 13:28:05.704226 -0500 CDT deployed postgres-operator-v1.7.0 v1.7.0
Upgrade using:
helm upgrade <RELEASE-NAME> /tmp/postgres-operator/ -f /<path-to-your-file>/operator_overrides_values.yaml --wait
where
RELEASE-NAME
is the name of the helm release listed from the list outputoperator_overrides_values.yaml
is the overrides fileThe output is similar to:
Release "postgres-operator" has been upgraded. Happy Helming!
NAME: postgres-operator
LAST DEPLOYED: Fri Jan 7 15:31:43 2022
NAMESPACE: default
STATUS: deployed
REVISION: 4
TEST SUITE: None
where REVISION
is a counter for the number of Operator upgrades you have performed. If you have upgraded from 1.0 to 1.1, and from 1.1 to 1.2, the REVISION number would be 3.
Verify the Postgres Operator status:
helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
postgres-operator default 4 2022-10-11 13:28:05.704226 -0500 CDT deployed postgres-operator-v3.0.0 v3.0.0
Confirm that the images version has also been upgraded:
kubectl describe statefulset.apps/<INSTANCE-NAME> | grep Image | uniq
where INSTANCE-NAME
is the name of the Postgres instance. For example:
Image: tanzu-sql-postgres.packages.broadcom.com/postgres-instance:v3.0.0
To verify the new Postgres instance version, use a command similar to:
kubectl exec pod/INSTANCE-NAME-0 -c pg-container -- psql -c 'select version()'
where INSTANCE-NAME
is the name of the Postgres instance.
Find the package repository name of the VMware Tanzu Data Services package repository:
tanzu package repository list -A
| Retrieving repositories...
NAME REPOSITORY TAG STATUS DETAILS NAMESPACE
tds-repo tanzu-sql-postgres.packages.broadcom.com/packages-for-vmware-tanzu-data-services/tds-packages 1.1.0 Reconcile succeeded postgres-operator
tanzu-rabbitmq-repo tanzu-sql-postgres.packages.broadcom.com/p-rabbitmq-for-kubernetes/tanzu-rabbitmq-package-repo 1.3.0 Reconcile succeeded rabbitmq-operator
where column NAME
represents the name of the package repository.
Note the namespace where tanzu-sql-postgres.packages.broadcom.com/packages-for-vmware-tanzu-data-services/tds-packages
repository is located.
Update the package repository to reflect the new target version:
tanzu package repository update <PACKAGE-REPOSITORY-NAME> \
--url <MY-REGISTRY>/<TARGET-REPOSITORY>/tds-packages:<TDS-VERSION> \
--namespace=<POSTGRES-OPERATOR-NAMESPACE>
where:
PACKAGE-REPOSITORY-NAME
is your chosen name for the installed package repositoryMY-REGISTRY
is your own image registryTARGET-REPOSITORY
is your target repositoryTDS-VERSION
is the target version you'll like to upgrade to (e.g. 1.5.0
)POSTGRES-OPERATOR-NAMESPACE
is the namespace of the packagerepository| Updating package repository 'tanzu-data-services-repository'
- Getting package repository 'tanzu-data-services-repository'
/ Getting package repository 'tanzu-data-services-repository'
| Validating provided settings for the package repository
| Updating package repository resource
- Waiting for 'PackageRepository' reconciliation for 'tanzu-data-services-repository'
/ 'PackageRepository' resource install status: Reconciling
Updated package repository 'tanzu-data-services-repository' in namespace 'default'
Verify you have updated the package repository
tanzu package repository get tanzu-data-services-repository --namespace=<POSTGRES-OPERATOR-NAMESPACE>
where POSTGRES-OPERATOR-NAMESPACE
is the namespace of the package repository.
- Retrieving repository tanzu-data-services-repository...
/ Retrieving repository tanzu-data-services-repository...
NAME: tanzu-data-services-repository
VERSION: 2571192
REPOSITORY: tanzu-sql-postgres.packages.broadcom.com/packages-for-vmware-tanzu-data-services/tds-packages
TAG: 1.14.0
STATUS: Reconcile succeeded
REASON:
Select your desired version of the available Postgres Operator version
tanzu package available list postgres-operator.sql.tanzu.vmware.com --namespace=<POSTGRES-OPERATOR-NAMESPACE>
where POSTGRES-OPERATOR-NAMESPACE
is the namespace of the package repository.
Update the Postgres Operator package to your desired version:
tanzu package installed update <PACKAGE-NAME> \
--package-name postgres-operator.sql.tanzu.vmware.com \
--version <POSTGRES-OPERATOR-VERSION> \
-f <YOUR-OVERRIDES-FILE-PATH> \
--namespace <POSTGRES-OPERATOR-NAMESPACE>
where:
PACKAGE-NAME
is the name you choose during installation.POSTGRES-OPERATOR-VERSION
is the Operator version you choose in the step aboveYOUR-OVERRIDES-FILE-PATH
is your custom overrides path and file, for example overrides.yaml
.POSTGRES-OPERATOR-NAMESPACE
is the namespace of the packagerepository| Updating installed package 'postgres-operator'
- Getting package install for 'postgres-operator'
/ Getting package install for 'postgres-operator'
/ Getting package metadata for 'postgres-operator.sql.tanzu.vmware.com'
| Updating package install for 'postgres-operator'
/ Waiting for 'PackageInstall' reconciliation for 'postgres-operator'
/ 'PackageInstall' resource install status: Reconciling
Updated installed package 'postgres-operator' in namespace 'default'
Verify the Postgres Operator package was updated successfully:
tanzu package installed get postgres-operator --namespace=<POSTGRES-OPERATOR-NAMESPACE>
where POSTGRES-OPERATOR-NAMESPACE
is the namespace of the package repository.
- Retrieving installation details for postgres-operator...
/ Retrieving installation details for postgres-operator...
NAME: postgres-operator
PACKAGE-NAME: postgres-operator.sql.tanzu.vmware.com
PACKAGE-VERSION:
STATUS: Reconcile succeeded
CONDITIONS: [{ReconcileSucceeded True }]
USEFUL-ERROR-MESSAGE: