This site will be decommissioned on January 30th 2025. After that date content will be available at techdocs.broadcom.com.

Upgrading MySQL Instances

Updated on   03/30/2022

This topic describes how to upgrade a Tanzu MySQL for Kubernetes instance after upgrading the operator.

Prerequisites

Before you upgrade a MySQL instance, you must have:

List Instances By Version

Each MySQL instance has a version label containing the version of the instance. The instance version corresponds to a version of Tanzu MySQL for Kubernetes.

Note: The version label was added in Tanzu MySQL for Kubernetes version 1.1.0. Upgrading the MySQL operator to version 1.1.0 or later causes the version label to be applied to existing MySQL instances automatically.

To list all MySQL instances at a specific version, run:

kubectl get mysql -l app.kubernetes.io/version=VERSION

Where VERSION is the version of VMware Tanzu™ SQL with MySQL for Kubernetes.

For example:

kubectl get mysql -l app.kubernetes.io/version=1.0.0
NAME READY STATUS VERSION AGE mysql-sample true Running 1.0.0 22m

Upgrade an Instance

Each VMware Tanzu™ SQL with MySQL for Kubernetes instance is based on a copy of the mysql.yaml deployment template file. The file for the instance should have a unique name (for example, testdb.yaml). To upgrade an instance, you must edit this configuration file.

To upgrade a MySQL instance:

  1. List all the instances across all namespaces in the cluster:

    kubectl get mysql -A

    which returns an output similar to:

    NAMESPACE NAME READY STATUS VERSION AGE my-namespace mysql-sample-2 true Running 1.0.0 2h31m acceptance mysql-sample true Running 1.1.0 6h42m
  2. 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
  3. Edit the configuration file for the MySQL instance, setting the spec.version property to the desired new version. (This property was added in VMware Tanzu™ SQL with MySQL for Kubernetes version 1.1.0.)

    For example:

    --- apiVersion: with.sql.tanzu.vmware.com/v1 kind: MySQL metadata: name: mysql-sample spec: version: 1.1.0 ...
  4. If you are upgrading the instance from VMware Tanzu™ SQL with MySQL for Kubernetes version 1.0 to version 1.1, you may need to update the spec.imagePullSecret property. In version 1.1.0, this property was renamed to imagePullSecretName, and the default secret name was changed from tanzu-mysql-image-registry to tanzu-image-registry. Make sure that you use the correct property name and value in the configuration file for the MySQL instance.

    For example, if you wish to continue using a secret named tanzu-mysql-image-registry:

    --- apiVersion: with.sql.tanzu.vmware.com/v1 kind: MySQL metadata: name: mysql-sample spec: version: 1.1.0 imagePullSecretName: tanzu-mysql-image-registry ...

    Alternatively, you can remove the property from the configuration file. If you remove the property, the MySQL instance will use the imagePullSecretName specified in the values-override.yaml or values.yaml file for the MySQL operator.

  5. Apply your changes by running:

    kubectl apply -f FILENAME

    Where FILENAME is the name of the configuration file.

    For example:

    kubectl apply -f testdb.yaml
    mysql.with.sql.tanzu.vmware.com/mysql-sample configured
  6. Verify that the instance was upgraded successfully by running:

    kubectl get mysql INSTANCE-NAME

    Where INSTANCE-NAME is the value configured for metadata.name in the configuration file.

    When the instance has been successfully upgraded, the value of the READY column for the instance should be true and the value of the VERSION column for the instance should report the new version. For example:

    kubectl get mysql mysql-sample
    NAME READY STATUS VERSION AGE mysql-sample true Running 1.1.0 24m
check-circle-line exclamation-circle-line Translation Error Open MyLibrary close-line
Scroll to top icon
Send Feedback Send Feedback