Upgrading the Postgres Operator Release
This topic provides steps to upgrade the Postgres operator currently deployed in your Kubernetes cluster to a new Postgres operator version.
Upgrading from VMWare Tanzu Postgres 0.4.0 or Later
Follow these steps to upgrade the Postgres operator version 0.4.0 or later to a newer Tanzu SQL with Postgres for Kubernetes release. Upgrading the Postgres operator does not upgrade existing Postgres instances. See Upgrading Postgres Instances for steps to upgrade instances.
Follow the steps in Installing Tanzu SQL with Postgres for Kubernetes to load the new Postgres operator and Postgres instances images into your container registry.
Upgrade the Postgres operator with the
helm upgrade
command.$ helm upgrade postgres-operator operator/
Release "postgres-operator" has been upgraded. Happy Helming! NAME: postgres-operator LAST DEPLOYED: Tue May 19 14:59:20 2020 NAMESPACE: default STATUS: deployed REVISION: 2 TEST SUITE: None
Verify the Postgres operator version.
$ helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION postgres-operator default 1 2020-06-16 13:28:05.704226 -0500 CDT deployed postgres-operator-v0.4.0
Warning Do not delete the Postgres operator when there are existing Postgres instances created by the operator. If the Postgres operator is deleted, you will get an error if you try to reinstall it. See Cannot Reinstall Operator after Deleting for a workaround to this problem.
Upgrading from VMware Tanzu Postgres 0.3.0 or Earlier
Tanzu SQL with Postgres 0.4.0 and later require that you install cert-manager
in the Kubernetes cluster before you install the Postgres operator. To upgrade from version 0.3.0 or earlier, you must remove the Postgres instance’s custom resource (CRD), install cert-manager
, and then upgrade the Postgres operator with Helm.
When you delete the Postgres instance’s CRD, your existing Postgres instances are also deleted. The instances’ PVCs are not deleted, however, so you just need to recreate the instances after upgrading the Postgres operator and the existing data will be available.
If you are upgrading the Postgres operator from Tanzu SQL with Postgres 0.3.0 or earlier, follow these steps:
Find the name of the current Postgres operator CRD.
$ kubectl get crds
NAME CREATED AT postgres.sql.tanzu.vmware.com 2020-05-19T18:30:23Z
List existing Postgres instances. You will need to recreate these after you upgrade the Postgres operator.
$ kubectl get postgres
Delete the CRD.
$ kubectl delete crd postgres.sql.tanzu.vmware.com
Create a certificate using
cert-manager
.$ kubectl apply --validate=false \ -f https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.yaml
Upgrade the Postgres operator.
- Follow the steps in Installing Tanzu SQL with Postgres to load the new Postgres operator and Postgres instance images into your container registry.
Upgrade the Postgres operator with
helm upgrade
.$ helm upgrade postgres-operator operator/
Release "postgres-operator" has been upgraded. Happy Helming! NAME: postgres-operator LAST DEPLOYED: Tue Jun 16 14:59:20 2020 NAMESPACE: default STATUS: deployed REVISION: 2 TEST SUITE: None
Verify the Postgres operator version.
$ helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION postgres-operator default 1 2020-06-16 13:28:05.704226 -0500 CDT deployed postgres-operator-v0.4.0
Recreate Postgres instances, using the same YAML manifest file used to create them initially. For example:
$ kubectl create -f pg-instance-example.yaml
The next time you upgrade the Postgres operator, you only need to perform step 5.