|
2 | 2 | This tutorial will explain how to create a mysqlcluster that runs the enterprise version of mysql.
|
3 | 3 |
|
4 | 4 | ## Prerequisites
|
5 |
| -- A Kubernetes Cluster running on Kubernetes 1.7.0+. |
| 5 | + |
6 | 6 | - The mysql-operator repository checked out locally.
|
7 | 7 | - Access to a Docker registry that contains the enterprise version of mysql.
|
8 | 8 |
|
9 |
| -## Create the Operator |
10 |
| -This file bundles the creation of various resources: |
| 9 | +## 01 - Create the Operator |
| 10 | +You will need to create the following: |
11 | 11 |
|
12 | 12 | 1. Custom resources
|
13 | 13 | 2. RBAC configuration <sup>*</sup>
|
14 | 14 | 3. The Operator
|
15 |
| -4. The Agent |
| 15 | +4. The Agent ServiceAccount & RoleBinding |
16 | 16 |
|
17 |
| -Section 3 of the file pulls the sql enterprise image from the docker store: `store/oracle/mysql-enterprise-server`. If you wish to pull the image from somewhere else you will need to swap out this address. |
18 |
| -``` |
19 |
| -kubectl apply -f examples/example-enterprise-deployment.yaml |
20 |
| -``` |
| 17 | +The creation of these resources can be achieved by following the [introductory tutorial][1]; return here before creating a MySQL Cluster. |
21 | 18 |
|
22 |
| -## Create a secret with registry credentials |
| 19 | +## 02 - Create a secret with registry credentials |
23 | 20 | To be able to pull the mysql enterprise edition from docker it is necessary to provide credentials, these credentials must be supplied in the form of a Kubernetes secret.
|
24 | 21 |
|
25 |
| -- The name of the secret `myregistrykey` must match the name in the `imagepullsecrets` which is found in Section 3 of the `example-enterprise-deployment.yaml`. |
26 |
| -- The secret must be created in the same namespace as the mysqlcluster which we will make in the next step. |
| 22 | +- The name of the secret `myregistrykey` must match the name in the `imagepullsecrets` which we will specify in the cluster config in step 03. |
| 23 | +- The secret must be created in the same namespace as the MySQL Cluster which we will make in step 03. It must also be in the same namespace as the RBAC permissions created in step 01. |
27 | 24 | - If you are pulling the mysql enterprise image from a different registry then the secret must contain the relevant credentials for that registry.
|
28 | 25 |
|
29 | 26 | >For alternative ways to create Kubernetes secretes see their documentation on [creating secrets from docker configs](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod) or [creating secrets manually](https://kubernetes.io/docs/concepts/containers/images/#creating-a-secret-with-a-docker-config).
|
30 | 27 |
|
31 |
| -Enter your credentials into the following command and execute it to create a Kubernetes secret that will enable pulling images from the Docker store. |
| 28 | +Enter your credentials into the following command and execute it to create a Kubernetes secret that will enable pulling images from the Docker store. add the `-n` flag to specify a namespace if you do not want to use the default namespace. |
32 | 29 | ```
|
33 | 30 | kubectl create secret docker-registry myregistrykey \
|
34 | 31 | --docker-server=https://index.docker.io/v1/ \
|
35 | 32 | --docker-username= \
|
36 | 33 | --docker-password= \
|
37 | 34 | --docker-email=
|
38 | 35 | ```
|
39 |
| -## Create your mysqlcluster |
40 |
| -Finally, create the mysqlcluster. |
| 36 | +## 03 - Create your MySQL Cluster |
| 37 | +Finally, create your MySQL Cluster with the required specifications entered under `spec:` |
41 | 38 |
|
42 |
| -- The version to be used has been specified in the file. Without this a default version is used which is **not** guaranteed to match an available image of mysql enterprise. |
43 |
| -- The lowest version supported by the mysql operator is **8.0.11** |
44 |
| -- The namespace of the cluster must match the namespace of the secret we created in the previous step. This file omits namespace in the metadata so the cluster will be created in the default namespace. |
| 39 | +- The mysqlServer field should be the path to a registry containing the enterprise edition of MySQL. |
| 40 | +- The imagePullSecret: name: Should be the name of a Kubernetes secret in the same namespace that contains your credentials for the docker registry. |
| 41 | +- The version to be used must be specified, without this, a default version is used which is **not** guaranteed to match an available image of MySQL Enterprise. |
| 42 | +- The namespace of the cluster must match the namespace of the secret we created in step 02. |
45 | 43 | ```
|
46 |
| -kubectl apply -f examples/cluster/cluster-with-3-members-enterprise-version.yaml |
| 44 | +kubectl apply -f examples/cluster/cluster-enterprise-version.yaml |
47 | 45 | ```
|
48 |
| -You can now run the following command to see the newly created mysql cluster |
| 46 | +### Check that it is running |
| 47 | +You can now run the following command to access the sql prompt in your MySQL Cluster, just replace `<NAMESPACE>` with the namespace you created your cluster in. |
49 | 48 | ```
|
50 |
| -kubectl describe mysqlcluster mysql |
| 49 | +sh hack/mysql.sh <NAMESPACE>/mysql-0 |
51 | 50 | ```
|
52 | 51 |
|
53 |
| -## Clean up |
54 |
| - |
55 |
| -To remove the mysqlcluster and each of the components created in this tutorial, execute the following: |
56 |
| -``` |
57 |
| -kubectl delete -f examples/cluster/cluster-with-3-members-enterprise-version.yaml |
58 |
| -kubectl delete secret myregistrykey |
59 |
| -kubectl delete -f examples/example-enterprise-deployment.yaml |
60 |
| -``` |
| 52 | +><sup>*</sup>If you run into issues when creating RBAC roles see [Access controls](https://docs.cloud.oracle.com/iaas/Content/ContEng/Concepts/contengabouta]ccesscontrol.htm?) for more information. |
61 | 53 |
|
62 |
| -><sup>*</sup>If you run into issues when creating RBAC roles see [Access controls](https://docs.cloud.oracle.com/iaas/Content/ContEng/Concepts/contengabouta]ccesscontrol.htm?) for more information. |
| 54 | +[1]: docs/tutorial.md |
0 commit comments