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 <%= product_name_long %> release. Upgrading the Postgres operator does not upgrade existing Postgres instances. See Upgrading Postgres Instances for steps to upgrade instances.

  1. Follow the steps in Installing a Postgres Operator to load the new Postgres operator and Postgres instances images into your container registry.

  2. 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
    
  3. 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

<%= product_name %> 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 <%= product_name %> 0.3.0 or earlier, follow these steps:

  1. 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
    
  2. List existing Postgres instances. You will need to recreate these after you upgrade the Postgres operator.

    $ kubectl get postgres
    
  3. Delete the CRD.

    $ kubectl delete crd postgres.sql.tanzu.vmware.com
    
  4. 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
    
  5. Upgrade the Postgres operator.

    • Follow the steps in Installing <%= product_name %> 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
      
  6. 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
    
  7. Recreate Postgres instances, using the same YAML manifest file used to create them initially. For example:

    $ kubectl create -f postgres.yaml
    

The next time you upgrade the Postgres operator, you only need to perform step 5.

check-circle-line exclamation-circle-line close-line
Scroll to top icon