This topic describes how to upgrade a VMware MySQL Operator instance after Upgrading the Operator.
Before you upgrade a MySQL instance, you must have:
Upgraded the MySQL operator. See Upgrading the VMware SQL with MySQL 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 VMware 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.27 8.0.27
mysql-8.0.28 8.0.28
mysql-8.0.29 8.0.29
mysql-8.0.31 8.0.31
mysql-latest 8.0.31
For a mapping of the VMware Operator version, with the corresponding instance version(s) supported with that Operator, review the table under Software Component Versions in the release notes.
The VMware MySQL 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 OPERATOR 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:
OPERATOR 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.31
...
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 OPERATOR VERSION
should display the latest Operator.
For instances requiring an update (UPDATE STATUS
="UpdateRequired"), refer to Updating an Instance.