This topic provides steps to upgrade a VMware Tanzu SQL with Postgres for Kubernetes instance to the latest version of the Tanzu Postgres software after you have upgraded to a new Postgres operator version. The data and backup PVCs for the instance are reattached unchanged to the upgraded instance.

See Upgrading the Postgres Operator Release for steps to upgrade the Postgres operator.

  1. List existing Postgres instances.

    $ kubectl get postgres
    
    NAME              STATUS    BACKUP LOCATION         AGE
    postgres-sample   Running   backuplocation-sample   58m
    

    Follow the remaining steps for each instance you want to upgrade.

  2. To check the current version of each Postgres instance, describe the instance's pod with kubectl describe pods/<instance-name>-0 and check the name of the container image.

    $ kubectl describe pod/postgres-sample-0
    
    Name:           postgres-sample-0
    Namespace:      default
    Priority:       0
    Node:           minikube/192.168.64.29
    Start Time:     Wed, 17 Jun 2020 10:50:41 -0500
    Labels:         app=postgres
                    controller-revision-hash=postgres-sample-5fc8fb8b4b
                    headless-service=postgres-sample
                    postgres-instance=postgres-sample
                    role=read
                    statefulset.kubernetes.io/pod-name=postgres-sample-0
                    type=data
    Annotations:    <none>
    Status:         Running
    IP:             172.17.0.8
    Controlled By:  StatefulSet/my-postgres
    Containers:
    pg-container:
        Container ID:  docker://f9425ba0656871abcdd9f86f2da2b3aef558644df15750d5292e86087241e443
        Image:         postgres-instance:v0.4.0
        Image ID:      docker://sha256:ae398da063c1e10ddccc05520f94b45d1cdbd3e37b3208250a473ede612ee479
        Port:          5432/TCP
        Host Port:     0/TCP
    ...
    
  3. Delete the Postgres instance.

    $ kubectl delete postgres postgres-sample
    
    postgres.sql.tanzu.vmware.com "postgres-sample" deleted
    
  4. Recreate the Postgres instance using the same manifest file you used previously.

    $ kubectl create -f postgres.yaml
    
    postgres.sql.tanzu.vmware.com/postgres-sample created
    
  5. Run kubectl describe pods/<instance-name>-0 again to check that the instance has been upgraded to the new version.

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