Upgrading Postgres Instances
This topic provides steps to upgrade a Tanzu SQL with Postgres for Kubernetes instance to the latest version of the Tanzu SQL with 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.
List existing Postgres instances.
$ kubectl get postgres
NAME STATUS AGE my-postgres Running 2d22h
Follow the remaining steps for each instance you want to upgrade.
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/my-postgres-0
Name: my-postgres-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=my-postgres-7b666bc94b postgres=my-postgres statefulset.kubernetes.io/pod-name=my-postgres-0 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 ...
Delete the Postgres instance.
$ kubectl delete postgres my-postgres
postgres.sql.tanzu.vmware.com "my-postgres" deleted
Recreate the Postgres instance using the same manifest file you used previously.
$ kubectl create -f pg-instance-example.yaml
postgres.sql.tanzu.vmware.com/my-postgres created
Run
kubectl describe pods/<instance-name>-0
again to check that the instance has been upgraded to the new version.