Updating a TanzuMySQL Instance

Warning: VMware Tanzu™ SQL with MySQL for Kubernetes is currently in beta and is intended for evaluation and test purposes only. Do not use this product in a production environment. If you discover any bugs, contact Support.

Page last updated:

This topic describes how to scale or change configurations on a VMware Tanzu™ SQL with MySQL for Kubernetes instance.

Prerequisites

Before you update the Tanzu MySQL for Kubernetes instance, you must have:

  • Access and permissions to the Tanzu MySQL for Kubernetes instance.

  • The Kubernetes Command Line Interface (kubectl) installed: For more information, see the Kubernetes documentation.

Scale storageSize

For storage classes that support storageSize, you can expand the storageSize but not reduce it.

To scale storageSize:

  1. Target the namespace where you want to scale storageSize:

    kubectl config set-context --current --namespace=DEVELOPMENT-NAMESPACE
    

    Where DEVELOPMENT-NAMESPACE is the namespace in which you want to scale storageSize.

    For example:

    $ kubectl config set-context --current --namespace=my-namespace
    
  2. Look up the storage class associated with the TanzuMySQL Pod’s Persistent Volume Claim (PVC):

    kubectl get pvc mysql-data-MYSQL-POD-NAME -o jsonpath={.spec.storageClassName}
    

    Where MYSQL-POD-NAME is the name of the TanzuMySQL Pod you are targeting.

    For example:

    $ kubectl get pvc mysql-data-my-pod -o jsonpath={.spec.storageClassName}
      standard
    
  3. Check if the storage class allows volume expansion. Look for the ALLOWVOLUMEEXPANSION column by running:

    kubectl get storageclass CLASS-RETURNED
    

    Where CLASS-RETURNED is the storageclass associated with the TanzuMySQL Pod’s PVC from the previous step.

    For example:

    $ kubectl get storageclass standard
    NAME                 PROVISIONER            RECLAIMPOLICY   VOLUMEBINDINGMODE    ALLOWVOLUMEEXPANSION   AGE
    standard (default)   kubernetes.io/gce-pd   Delete          Immediate            true                   91s
    
  4. If the output does not show the ALLOWVOLUMEEXPANSION column, run:

    kubectl get storageclasses.storage.k8s.io standard \
    -o custom-columns='NAME:.metadata.name,ALLOWVOLUMEEXPANSION:.allowVolumeExpansion'

  5. If you are using Kubernetes v1.11 and volume expansion is supported, change the allowVolumeExpansion field to true in StorageClass objects. Only PVCs created from a StorageClass with allowVolumeExpansion set to true are allowed to perform volume expansion. For more information, see the Kubernetes documentation.

  6. Edit the PVC spec.resources.requests.storage field to increase the volume size by running:

    kubectl edit pvc mysql-data-MYSQL-POD-NAME
    
    For example:
    $ kubectl edit pvc mysql-data-MYSQL-POD-NAME
    persistentvolumeclaim/mysql-data-MYSQL-POD-NAME edited
    

  7. Do one of the following:

    • If the storageClass supports online expansion: Wait for the PVC to automatically resize. For more information, see the Kubernetes documentation.

    • Otherwise: Wait for the PVC to have the FileSystemResizePending condition. Delete the TanzuMySQL Pod to unmount the PVC and allow it to resize.
      kubectl wait --for=condition=FileSystemResizePending pvc/mysql-data-MYSQL-POD-NAME
      kubectl rollout restart statefulset MYSQL-INSTANCE-NAME
      For example:
      $ kubectl wait --for=condition=FileSystemResizePending pvc/mysql-data-MYSQL-POD-NAME
      persistentvolumeclaim/mysql-data-tanzumysql-sample-0 condition met 
      $ kubectl rollout restart statefulset MYSQL-INSTANCE-NAME statefulset.apps/tanzumysql-sample restarted
  8. After the StatefulSet controller has automatically re-created the TanzuMySQL Pod, and the TanzuMySQL Pod has successfully restarted, verify that the storage has been resized.

    kubectl exec MYSQL-POD-NAME -c mysql -- df -h /var/lib/mysql
    For example:
    $ kubectl exec MYSQL-POD-NAME -c mysql -- df -h /var/lib/mysql
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sdb        3.0G  346M  2.6G  12% /var/lib/mysql

Expected Downtime When Scaling storageSize

The expected downtime when expanding storage is as follows:

  • With online expansion: There is no downtime expected in most cases.
  • With offline expansion: There is downtime while the TanzuMySQL Pod is re-created and the PVC is being resized.

Scale CPU and Memory Resources

To scale CPU or memory resources:

  1. Edit the Tanzu MySQL configuration’s spec.resources field to increase the CPU or memory requirements for the mysql or backups containers.
    kubectl edit tanzumysql MYSQL-INSTANCE-NAME
    For example:
    $ kubectl edit tanzumysql MYSQL-INSTANCE-NAME
    tanzumysql.mysql.tanzu.vmware.com/MYSQL-INSTANCE-NAME edited

Expected Downtime When Scaling CPU and Memory Resources

The expected downtime when changing resource reservations is as follows:

  • Brief downtime while Kubernetes re-creates the TanzuMySQL Pods.
  • Risk of longer downtime if the new requested values exceed the available capacity of the Kubernetes cluster.

Change Other Configurations

Changing storageClassName or imagePullSecret does not have any effect on a running TanzuMySQL instance. If a TanzuMySQL instance is not running due to errors in these fields, you can change them. The changes are propagated into the StatefulSet to correct the error.

To change storageClassName or imagePullSecret:

  1. Edit the Tanzu MySQL configuration spec.
    kubectl edit tanzumysql MYSQL-INSTANCE-NAME
    For example:
    $ kubectl edit tanzumysql MYSQL-INSTANCE-NAME
    tanzumysql.mysql.tanzu.vmware.com/MYSQL-INSTANCE-NAME edited