MySQL Operator for Kubernetes Manual  /  Upgrading MySQL Operator

Chapter 4 Upgrading MySQL Operator

Upgrading MySQL Operator

Apply MySQL Operator's latest released CRDs to create a new MySQL Operator deployment that replaces the old. The old operator is terminated after the new operator is started and ready, which should not cause downtime.

kubectl apply -f
kubectl apply -f

This only updates MySQL Operator and not the associated MySQL InnoDB Cluster.

Using trunk in the URL references the latest MySQL Operator for Kubernetes release because Github is updated at release time. Alternatively, replace trunk in the URL with a specific tagged released version.

Upgrading MySQL InnoDB Cluster

This assumes you already upgraded MySQL Operator.

We recommend using MySQL Shell's checkForServerUpgrade() utility to confirm that a MySQL InnoDB Cluster is ready for upgrade. This example creates a temporary 8.4.0 pod (which includes MySQL Shell 8.4.0) to check if the InnoDB Cluster named mycluster is compatible to upgrade to MySQL 8.4.0:

$> kubectl run \
    --rm -it mysh -- mysqlsh -uroot -p -hmycluster -- util checkForServerUpgrade


If you don't see a command prompt, try pressing enter.
Save password for 'root@mycluster'? [Y]es/[N]o/Ne[v]er (default No): N
The MySQL server at mycluster:33060, version 8.3.0 - MySQL Community Server -
GPL, will now be checked for compatibility issues for upgrade to MySQL 8.4.0.
To check for a different target server version, use the targetVersion option...

1) Issues reported by 'check table x for upgrade' command
  No issues found

Errors:   0
Warnings: 0
Notices:  0

No known compatibility errors or issues were found.
Session ended, resume using 'kubectl attach mysh -c mysh -i -t' command when the pod is running
pod "mysh" deleted

A common upgrade method is to patch the MySQL server version. For example, this updates the MySQL Server version to 8.4.0 for a MySQL InnoDB Cluster named mycluster:

kubectl patch ic mycluster -p '{"spec": { "version": "8.4.0" } }' --type=merge

An update to spec.version for a MySQL InnoDB Cluster updates the following:

  • Each MySQL server, in a rolling update

    Updating a MySQL InnoDB Cluster initiates a rolling restart of the MySQL servers; the upgrade replaces MySQL servers in order, by highest value in the name to lowest. This can cause multiple failovers of the primary, depending on the current and assigned primaries.

  • MySQL Router to the specified spec.version unless spec.router.version is also explicitly set in the patch

  • The MySQL sidecar container for each server to the installed MySQL Operator version

  • MySQL Shell to the specified spec.version

The MySQL InnoDB Cluster remains available during the upgrade process but the associated restarts may interrupt existing connections.