Upgrading the Tanzu Postgres Operator and Instances

This topic provides steps to upgrade the Tanzu Postgres operator and Tanzu Postgres instances to a newer version. Upgrading the Postgres operator also upgrades the existing Postgres instances.

  1. Download the latest VMware Tanzu Postgres version from VMware Tanzu Network. Load the new Postgres operator and Postgres instances images into your container registry following the steps in Load Tanzu SQL with Postgres for Kubernetes Images to Docker Registry.

  2. Create an operator-overrides.yaml file at a location of your choice, and enter the parameters below replacing operatorImageRepository, postgresImageRepository, and dockerRegistrySecretName with your values:

    # specify the url for the docker image for the operator, e.g. gcr.io/<my_project>/postgres-operator
    operatorImageRepository: gcr.io/data-pcf-db/postgres-operator
    
    # specify the docker image for postgres instance, e.g. gcr.io/<my_project>/postgres-instance
    postgresImageRepository: gcr.io/data-pcf-db/postgres-instance
    
    # specify the name of the docker-registry secret to allow the cluster to authenticate with the container registry for pulling images
    dockerRegistrySecretName: regsecret
    
  3. Upgrade the Postgres operator and instances with the helm upgrade command, specifying your location of the operator-overrides.yaml file:

    $ helm upgrade -f ./operator-overrides.yaml postgres-operator operator/
    

    The output is similar to:

    Release "postgres-operator" has been upgraded. Happy Helming!
    NAME: postgres-operator 
    LAST DEPLOYED: Thu Dec 10 15:31:43 2020
    NAMESPACE: default
    STATUS: deployed
    REVISION: 2
    TEST SUITE: None
    
  4. Verify that the new Postgres operator version. The Postgres Operator is updated across all namespaces, including the default.

    $ helm ls
    
    NAME                NAMESPACE   REVISION    UPDATED                                 STATUS      CHART                     APP VERSION
    postgres-operator   default     2           2021-02-16 13:28:05.704226 -0500 CDT    deployed    postgres-operator-v1.1.0  v1.1.0
    
  5. Verify the image version matches the new operator version:

    $ cat images/postgres-*-tag
    v1.1.0
    v1.1.0
    

    Confirm that the images version has also been upgraded:

    $ kubectl describe statefulset.apps/<your-database-name> | grep Image
    Image:      gcr.io/data-pcf-db/postgres-instance:v1.1.0
    Image:      gcr.io/data-pcf-db/postgres-instance:v1.1.0
    Image:      gcr.io/data-pcf-db/postgres-instance:v1.1.0
    

    If you have a High Availability configuration, verify the upgrade using:

    $ kubectl describe statefulset.apps/<your-ha-database> | grep Image
    Image:      gcr.io/data-pcf-db/postgres-instance:v1.1.0
    Image:      gcr.io/data-pcf-db/postgres-instance:v1.1.0
    Image:      gcr.io/data-pcf-db/postgres-instance:v1.1.0