The original MySQL Operator for Kubernetes repo doesn't provide ARM64 builds. This is unfortunate since MySQL docker images have arm support, but since the operator itself isn't built for that platform you can't deploy it in your clusters via an operator.
Upstream repo doesn't provide their "python-deps" docker image either. This repo follows Oracle's documentation to build a Python container with all the requirements installed.
I provide a helm repo with the same charts, which already includes these defaults for mysql-operator. See here: https://canozokur.github.io/mysql-operator
For mysql-innodbcluster chart, things are a bit more complicated. The original chart doesn't allow you to override podSpec for your router instances. I had to add support for it. An example values file can look like this:
podSpec: initContainers: - name: fixdatadir image: ghcr.io/canozokur/mysql-operator:8.0.31-2.0.7 - name: initconf image: ghcr.io/canozokur/mysql-operator:8.0.31-2.0.7 containers: - name: sidecar image: ghcr.io/canozokur/mysql-operator:8.0.31-2.0.7 router: podSpec: containers: - name: router image: ghcr.io/canozokur/mysql-router:8.0.31 And don't forget to change the tags according to your needs!
Original README included below:
The MySQL Operator for Kubernetes is an operator for managing MySQL InnoDB Cluster setups inside a Kubernetes Cluster. It manages the full lifecycle with set up and maintenance that includes automating upgrades and backup.
MySQL Operator for Kubernetes is brought to you by the MySQL team at Oracle.
As with all MySQL projects, issues (including bugs and feature requests) are tracked here:
Pull requests submitted via github are also tracked at bugs.mysql.com; see CONTRIBUTING for related information.
Copyright (c) 2020, 2023, Oracle and/or its affiliates.
License information can be found in the LICENSE file. This distribution may include materials developed by third parties. For license and attribution notices for these materials, please refer to the LICENSE file.
First deploy the Custom Resource Definition (CRDs):
$> kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-crds.yamlThen deploy MySQL Operator for Kubernetes:
$> kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-operator.yamlVerify the operator is running by checking the deployment inside the mysql-operator namespace:
$> kubectl get deployment -n mysql-operator mysql-operator NAME READY UP-TO-DATE AVAILABLE AGE mysql-operator 1/1 1 1 1hAlternatively, you may use Helm; which is a package manager for Kubernetes.
Install the Helm repository:
$> helm repo add mysql-operator https://mysql.github.io/mysql-operator/ $> helm repo updateThen deploy the operator:
$> helm install mysql-operator mysql-operator/mysql-operator --namespace mysql-operator --create-namespaceThis deploys the latest MySQL Operator for Kubernetes from DockerHub using all defaults; although the deployment can be customized through a variety of options to override built-in defaults. See the documentation for details.
For creating a MySQL InnoDB Cluster, first create a secret with credentials for a MySQL root user used to perform administrative tasks in the cluster. For example:
$> kubectl create secret generic mypwds \ --from-literal=rootUser=root \ --from-literal=rootHost=% \ --from-literal=rootPassword="sakila"Define your MySQL InnoDB Cluster, which references the secret. For example:
apiVersion: mysql.oracle.com/v2 kind: InnoDBCluster metadata: name: mycluster spec: secretName: mypwds tlsUseSelfSigned: true instances: 3 router: instances: 1Assuming it's saved as mycluster.yaml, deploy it:
$> kubectl apply -f mycluster.yamlThis sample creates an InnoDB Cluster with three MySQL Server instances and one MySQL Router instance. The process can be observed using:
$> kubectl get innodbcluster --watch NAME STATUS ONLINE INSTANCES ROUTERS AGE mycluster PENDING 0 3 1 2m6s ... mycluster ONLINE 3 3 1 10sCreate MySQL InnoDB Cluster installations using defaults or with customization. Here's an example using all defaults for a cluster named mycluster:
$> helm install mycluster mysql-operator/mysql-innodbclusterOr customize, this example sets options from the command line:
$> helm install mycluster mysql-operator/mysql-innodbcluster \ --namespace mynamespace \ --create-namespace \ --set credentials.root.user='root' \ --set credentials.root.password='supersecret' \ --set credentials.root.host='%' \ --set serverInstances=3 \ --set routerInstances=1A MySQL InnoDB Cluster Service is created inside the Kubernetes cluster:
$> kubectl get service mycluster NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE mycluster ClusterIP 10.110.228.51 <none> 3306/TCP,33060/TCP,6446/TCP,6448/TCP,6447/TCP,6449/TCP 26hThe ports represent read-write and read-only ports for the MySQL Protocol and the X Protocol. Use describe or see the documentation for additional information.
This example creates a new container named myshell using the mysql/mysql-operator image (which is used because it contains MySQL Shell; other images such as mysql/mysql-server:8.0 work too), and immediately executes MySQL Shell:
$> kubectl run --rm -it myshell --image=mysql/mysql-operator -- mysqlsh If you don't see a command prompt, try pressing enter. MySQL JS> \connect root@mycluster Creating a session to 'root@mycluster' Please provide the password for 'root@mycluster': ****** MySQL mycluster JS>Using root@mycluster connection assumes the default namespace is used; the long form is {innodbclustername}.{namespace}.svc.cluster.local. Each MySQL instance has MySQL Shell installed that can be used when troubleshooting.
Kubernetes port forwarding creates a redirection from your local machine to use a MySQL client, such as mysql or MySQL Workbench. For example, for read-write connection to the primary using the MySQL protocol:
$> kubectl port-forward service/mycluster mysql Forwarding from 127.0.0.1:3306 -> 6446 Forwarding from [::1]:3306 -> 6446And in a second terminal:
$> mysql -h127.0.0.1 -P3306 -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. ...When prompted, enter the password used when creating the Secret.
Refer to the official documentation at:
For additional downloads and the source code, visit:
Contributing to MySQL Operator for Kubernetes, see:
- See CONTRIBUTING