Upgrade to a specific version¶
Assumptions¶
For the procedures in this tutorial, we assume that you have set up the Smart Update strategy to update the objects in your database cluster.
Read more about the Smart Update strategy and other available ones in the Upgrade strategies section.
Procedure¶
To upgrade Percona Server for MongoDB to a specific version, do the following:
-
Check the version of the Operator you have in your Kubernetes environment. If you need to update it, refer to the Operator upgrade guide.
-
Check the Custom Resource manifest configuration to be the following:
spec.updateStrategy
option is set toSmartUpdate
spec.upgradeOptions.apply
option is set toDisabled
orNever
.
... spec: updateStrategy: SmartUpdate upgradeOptions: apply: Disabled ...
-
Check the current version of the Custom Resource and what versions of the database and cluster components are compatible with it. Use the following command:
$ curl https://check.percona.com/versions/v1/psmdb-operator/1.20.0 |jq -r '.versions[].matrix'
You can also find this information in the Versions compatibility matrix.
-
Update the database, the backup and PMM Client image names with a newer version tag. Find the image names in the list of certified images.
We recommend to update the PMM Server before the upgrade of PMM Client. If you haven’t done it yet, exclude PMM Client from the list of images to update.
Since this is a working cluster, the way to update the Custom Resource is to apply a patch with the
kubectl patch psmdb
command.This example command updates the cluster with the name
my-cluster-name
to the1.20.0
version:$ kubectl patch psmdb my-cluster-name --type=merge --patch '{ "spec": { "crVersion":"1.20.0", "image": "percona/percona-server-mongodb:7.0.18-11", "backup": { "image": "percona/percona-backup-mongodb:2.9.1" }, "pmm": { "image": "percona/pmm-client:2.44.1" } }}'
$ kubectl patch psmdb my-cluster-name --type=merge --patch '{ "spec": { "crVersion":"1.20.0", "image": "percona/percona-server-mongodb:7.0.18-11", "backup": { "image": "percona/percona-backup-mongodb:2.9.1" } }}'
-
After you applied the patch, the deployment rollout will be triggered automatically. You can track the rollout process in real time using the
kubectl rollout status
command with the name of your cluster:$ kubectl rollout status sts my-cluster-name-rs0
The update process is successfully finished when all Pods have been restarted. If you turned on Percona Server for MongoDB Sharding, the mongos and Config Server nodes must be restarted too to complete the upgrade.