You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

New to KubeDB? Please start here.

Upgrade version of ProxySQL Cluster

This guide will show you how to use KubeDB Enterprise operator to upgrade the version of ProxySQL Cluster.

Before You Begin

  • At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using kind.

  • Install KubeDB Community and Enterprise operator in your cluster following the steps here.

  • You should be familiar with the following KubeDB concepts:

To keep everything isolated, we are going to use a separate namespace called demo throughout this tutorial.

$ kubectl create ns demo
namespace/demo created

Also we need a mysql backend for the proxysql server. So we are creating one with the below yaml.

kind: MySQL
  name: mysql-server
  namespace: demo
  version: "5.7.36"
  replicas: 3
    mode: GroupReplication
  storageType: Durable
    storageClassName: "standard"
      - ReadWriteOnce
        storage: 1Gi
  terminationPolicy: WipeOut
$ kubectl create -f created 

After applying the above yaml wait for the MySQL to be Ready.

Prepare ProxySQL Cluster

Now, we are going to deploy a ProxySQL cluster with version 2.3.2-debian.

Deploy ProxySQL cluster

In this section, we are going to deploy a ProxySQL Cluster. Then, in the next section we will upgrade the version of the instance using ProxySQLOpsRequest CRD. Below is the YAML of the ProxySQL CR that we are going to create,

kind: ProxySQL
  name: proxy-server
  namespace: demo
  version: "2.3.2-debian"
  replicas: 3
  mode: GroupReplication
    name: mysql-server
  syncUsers: true
  terminationPolicy: WipeOut

Let’s create the ProxySQL CR we have shown above,

$ kubectl create -f created

Now, wait until proxy-server created has status Ready. i.e,

$ kubectl get proxysql -n demo                                                                                                                                             
NAME             VERSION       STATUS     AGE
proxy-server   2.3.2-debian    Ready     3m15s

We are now ready to apply the ProxySQLOpsRequest CR to upgrade this database.

Upgrade ProxySQL Version

Here, we are going to upgrade ProxySQL cluster from 2.3.2-debian to 2.4.4-debian.

Create ProxySQLOpsRequest:

In order to upgrade the database cluster, we have to create a ProxySQLOpsRequest CR with your desired version that is supported by KubeDB. Below is the YAML of the ProxySQLOpsRequest CR that we are going to create,

kind: ProxySQLOpsRequest
  name: proxyops-upgrade
  namespace: demo
  type: UpdateVersion
    name: proxy-server
    targetVersion: "2.4.4-debian"


  • specifies that we are performing operation on proxy-server ProxySQL database.
  • spec.type specifies that we are going to perform Upgrade on our database.
  • spec.upgrade.targetVersion specifies the expected version of the database 2.4.4-debian.

Let’s create the ProxySQLOpsRequest CR we have shown above,

$ kubectl apply -f created

Verify ProxySQL version upgraded successfully

If everything goes well, KubeDB Enterprise operator will update the image of ProxySQL object and related StatefulSets and Pods.

Let’s wait for ProxySQLOpsRequest to be Successful. Run the following command to watch ProxySQLOpsRequest CR,

$ kubectl get proxysqlopsrequest -n demo
Every 2.0s: kubectl get proxysqlopsrequest -n demo
NAME                   TYPE      STATUS       AGE
proxyops-upgrade      Upgrade   Successful    84s

We can see from the above output that the ProxySQLOpsRequest has succeeded.

Now, we are going to verify whether the ProxySQL and the related StatefulSets and their Pods have the new version image. Let’s check,

$ kubectl get proxysql -n demo proxy-server -o=jsonpath='{.spec.version}{"\n"}'

$ kubectl get sts -n demo proxy-server -o=jsonpath='{.spec.template.spec.containers[0].image}{"\n"}'

$ kubectl get pods -n demo proxy-server-0 -o=jsonpath='{.spec.containers[0].image}{"\n"}'

You can see from above, our ProxySQL cluster database has been updated with the new version. So, the upgrade process is successfully completed.

Cleaning Up

To clean up the Kubernetes resources created by this tutorial, run:

$ kubectl delete proxysql -n demo proxy-server
$ kubectl delete proxysqlopsrequest -n demo proxyops-upgrade