This topic describes how to upgrade a Tanzu MySQL for Kubernetes instance after Upgrading the Operator.
Before you upgrade a MySQL instance, you must have:
Upgraded the MySQL operator. See Upgrading the Tanzu SQL for Kubernetes Operator.
Access to and permissions for the MySQL instance.
The Kubernetes Command Line Interface (kubectl) installed. For more information, see the Kubernetes documentation.
The MySQL instance property spec.mysqlVersion.name can be used to specify a required MySQL version. Every Tanzu MySQL Operator (after 1.4.0 release) supports several MySQL versions, giving the customers the flexibility to specify their preference, and upgrade to a later MySQL version.
NOTE: Upgrading the MySQL Operator does not automatically upgrade any existing MySQL instances. Any instance upgrades require user intervention.
To list the supported MySQL versions for a specific Operator, run:
kubectl get mysqlversions
Depending on the Operator version, the command displays an ouput similar to:
NAME DB VERSION
mysql-8.0.26 8.0.26
mysql-8.0.27 8.0.27
mysql-8.0.28 8.0.28
mysql-latest 8.0.28
For a mapping of the Tanzu Operator version, with the corresponding instance version(s) supported with that Operator, review the table under Software Component Versions in the release notes.
The Tanzu Operator supports two columns to help users identify upgrade actions for existing instances, UPDATE STATUS and USER ACTION.
WARNING: User actions specified under the USER ACTION column result in instance reboot. Ensure these actions are executed during an agreed maintenance window.
List the versions of all deployed instances, and their compatibility with the latest Operator by running:
kubectl get mysql
with an output similar to:
NAME READY STATUS AGE TANZU VERSION DB VERSION UPDATE STATUS USER ACTION
mysql-sample true Running 41m 1.4.0 8.0.26 NoUpdateRequired
DBUPDONC-9 true Running 20d 1.3.0 8.0.26 UpdateRequired Annotate “mysql.with.sql.tanzu.vmware.com/update=once”
instance-8 true Running 21d 1.3.0 8.0.25 UpdateRequired Annotate “mysql.with.sql.tanzu.vmware.com/update=once”
instance-7 true Running 22d 1.3.0 8.0.23 DBUpgradeRequired Set spec.mysqlVersion.name to a supported DB version
DBAUTOUPG-6 true Running 120d 1.2.0 8.0.26 UpdateRequired Annotate “mysql.with.sql.tanzu.vmware.com/update=once”
instance-5 true Running 121d 1.2.0 8.0.25 UpdateRequired Annotate “mysql.with.sql.tanzu.vmware.com/update=once”
instance-4 true Running 122d 1.2.0 8.0.23 DBUpgradeRequired Set spec.mysqlVersion.name to a supported DB version
DBAUTOUPG-3 true Running 150d 1.1.0 8.0.25 UpdateRequired Annotate “mysql.with.sql.tanzu.vmware.com/update=once”
instance-2 true Running 151d 1.1.0 8.0.23 DBUpgradeRequired Set spec.mysqlVersion.name to a supported DB version
instance-1 true Running 202d 1.0.0 8.0.23 DBUpgradeRequired Set spec.mysqlVersion.name to a supported DB version
Where:
TANZU VERSION column refers to the Operator version that the instance was last reconciled (synchronized) with.DB VERSION column refers to the instance's current MySQL database version.UPDATE STATUS refers to whether the instance needs an update or a database version upgrade.
USER ACTION specifies the user action required to ensure the MySQL instances are under a supported version, or the need for reconciliation.For each of the instances with UPDATE STATUS=DBUpgradeRequired, target the namespace of the MySQL instance:
kubectl config set-context --current --namespace=DEVELOPMENT-NAMESPACE
Where DEVELOPMENT-NAMESPACE is the namespace in which the instance was created. For example:
kubectl config set-context --current --namespace=my-namespace
Edit the configuration file for the MySQL instance, setting the spec.mysqlVersion.name property to the desired new version. For example:
---
apiVersion: with.sql.tanzu.vmware.com/v1
kind: MySQL
metadata:
name: instance-7
spec:
mysqlVersion:
name: mysql-8.0.26
...
Apply the changes by running:
kubectl apply -f FILENAME
Where FILENAME is the name of the configuration file. For example:
kubectl apply -f instance-7-db.yaml
mysql.with.sql.tanzu.vmware.com/mysql-sample configured
Verify that the instance was upgraded successfully by running:
kubectl get mysql
The UPDATE STATUS column of the instance should display NoUpdateRequired. The TANZU VERSION should display the latest Operator.
For instances requiring an update (UPDATE STATUS="UpdateRequired"), refer to Updating an Instance.