# K8s + cluster-wide + mysql version

**URL:** <https://forums.percona.com/t/k8s-cluster-wide-mysql-version/8832>\
**Category:** Percona Operator for MySQL\
**Created:** [January 18, 2021, 4:11pm UTC](https://forums.percona.com/t/k8s-cluster-wide-mysql-version/8832 "2021-01-18T16:11:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![magic](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/magic/32/2592_2.png) [@magic](https://forums.percona.com/u/magic)\
**Post date:** [January 18, 2021, 4:11pm UTC](https://forums.percona.com/t/k8s-cluster-wide-mysql-version/8832/1 "2021-01-18T16:11:00Z")

</div>

Hi Guys,

I have some, pretty simple questions, but I am not sure if I get it right.

I have installed the `cluster-wide` deployment as per docs here: [cluster-wide-docs](https://www.percona.com/doc/kubernetes-operator-for-pxc/cluster-wide.html)  
The `cluster-wide` install is done from the branch `v1.6.0`. All runs fine.

Now I am confused with mysql versions.

I would like to use mysql version 5.7. As per docs this seems to be possible to either deploy one or another (8.0).

I can deploy client version 8.0:

```auto
kubectl run -i --rm --tty percona-client --image=percona:8.0 --restart=N│
ever --env="POD_NAMESPACE=<namespace>" -- bash -il

```

or I can deploy client version 5.7:

```auto
kubectl run -i --rm --tty percona-client --image=percona:5.7--restart=N│
ever --env="POD_NAMESPACE=<namespace>" -- bash -il

```

But as I understand I also have to deploy the cluster with the image of `pxc:` set to proper version, either:

```auto
pxc:
    size: 3
    image: percona/percona-xtradb-cluster:8.0.20-11.1

```

or:

```auto
  pxc:
    size: 3
    image: percona/percona-xtradb-cluster:5.7.31-31.45

```

Question 1:  
Is this all I need to run mysql with proper version (either 8.0 or 5.7)?  
Actually it looks like, like the version depends only on the `percona-client`, not the `percona-xtradb-cluster:version`. Is this so?

Question 2:  
Do I have also to redeploy operator for another version, related to mysql5.7 (but that does not seem necessary). If yes, how do I figure out proper versions?

---

<div class="post-metadata">

**Author:** ![Tomislav\_Plavcic](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tomislav_plavcic/32/9717_2.png) [@Tomislav\_Plavcic](https://forums.percona.com/u/Tomislav_Plavcic)\
**Post date:** [January 18, 2021, 5:06pm UTC](https://forums.percona.com/t/k8s-cluster-wide-mysql-version/8832/2 "2021-01-18T17:06:29Z")

</div>

Hi @magic !

For selecting the PXC version few things are important in cr.yaml:

1. PXC image:

```auto
  pxc:
    size: 3
    image: percona/percona-xtradb-cluster:8.0.20-11.2

```

1. backup image for 8.0:

```auto
  backup:
    image: percona/percona-xtradb-cluster-operator:1.6.0-pxc8.0-backup

```

and for 5.7:

```auto
  backup:
    image: percona/percona-xtradb-cluster-operator:1.6.0-pxc5.7-backup

```

1. Disable SmartUpdate (change “apply: recommended” to “apply: disabled”):

```auto
  updateStrategy: SmartUpdate
  upgradeOptions:
    versionServiceEndpoint: https://check.percona.com
    apply: disabled

```

This is doing automatic minor PXC version upgrade (when available), but if you leave it enabled while starting the cluster it will always install latest 8.0 regardless of the images you specified in cr.yaml.

The client you are mentioning is only used to connect to the cluster and I think it should be safe to use even the latest major version (8.0) even for older clusters (eg. 5.7), although best use the same version.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![magic](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/magic/32/2592_2.png) [@magic](https://forums.percona.com/u/magic)\
**Post date:** [January 18, 2021, 6:41pm UTC](https://forums.percona.com/t/k8s-cluster-wide-mysql-version/8832/3 "2021-01-18T18:41:23Z")

</div>

Hello @Tomislav_Plavcic

Thank you for reply. That have helped me to figure it out.

For the sake of helping others who might have the same question, the way I’m doing it right now is:

The cr.yaml for mysql 5.7:

```nohighlight
  updateStrategy: SmartUpdate
  upgradeOptions:
    versionServiceEndpoint: https://check.percona.com
    apply: disabled
    schedule: "0 4 * * *"
  pxc:
    size: 3
    image: percona/percona-xtradb-cluster:5.7.31-31.45
[..]
  backup:
    image: percona/percona-xtradb-cluster-operator:1.6.0-pxc5.7-backup

```

The cr.yaml for mysql 8.0:

```nohighlight
  updateStrategy: SmartUpdate
  upgradeOptions:
    versionServiceEndpoint: https://check.percona.com
    apply: disabled
    schedule: "0 4 * * *"
  pxc:
    size: 3
    image: percona/percona-xtradb-cluster:8.0.20-11.2
[..]
  backup:
    image: percona/percona-xtradb-cluster-operator:1.6.0-pxc8.0-backup

```

The percona-client, because it’s backward compatible can run with `percona:8.0` image:

```bash
kubectl run -i --rm --tty percona-client --image=percona:8.0 --restart=Never --env="POD_NAMESPACE=<namespace>" -- bash -il

```

This runs a client version:

```auto
[mysql@percona-client /]$ mysql -V                                                    
mysql Ver 8.0.22-13 for Linux on x86_64 (Percona Server (GPL), Release 13, Revision 6f7

```

But when you log in to the server:

```bash
[mysql@percona-client /]$ mysql -h cluster1-haproxy -uroot -p<password>
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 675
Server version: 5.7.31-34-57 Percona XtraDB Cluster (GPL), Release rel34, Revision 7359e4f, WSREP version 31.45, wsrep_31.45

Copyright (c) 2009-2020 Percona LLC and/or its affiliates
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

```

The cw-bundle.yaml (cluster-wide deployment), which is responsible for the percona-operator deployed in `pxc-operator` namespace is running default image version, which is:

```nohighlight
    spec:
      serviceAccountName: percona-xtradb-cluster-operator
      containers:
        - name: percona-xtradb-cluster-operator
          image: percona/percona-xtradb-cluster-operator:1.6.0

```

Hope someone will find those information useful.

Thanks again for help and support.
