github.com/mre-fog/trillianxx@v1.1.2-0.20180615153820-ae375a99d36a/storage/mysql/kubernetes/README.md (about) 1 :exclamation: **EXPERIMENTAL** :exclamation: 2 3 # MySQL on Kubernetes 4 5 ## Usage 6 7 To run a Galera MySQL cluster on Google Cloud, install the 8 [Cloud SDK](https://cloud.google.com/sdk/) and configure it for your project. 9 [Provision a Container cluster](https://cloud.google.com/container-engine/docs/clusters/operations), 10 then run the following command: 11 ```shell 12 kubectl apply -f $GOPATH/src/github.com/google/trillian/storage/mysql/kubernetes 13 ``` 14 15 This will start the Galera cluster. You can monitor provisoning of this cluster 16 by visiting http://127.0.0.1:8001/ui/ after running: 17 ```shell 18 kubectl proxy 19 ``` 20 21 This dashboard will also show the external IP of the cluster on the 22 "Services" page, on the row for the "mysql" service. 23 24 Once the cluster has been provisioned, prepare the database for use by Trillian 25 by running: 26 ```shell 27 $GOPATH/src/github.com/google/trillian/storage/mysql/kubernetes/resetdb.sh 28 ``` 29 30 ### Firewall 31 32 By default, the load balancer that exposes the MySQL service will only accept 33 connections from 10.0.0.0/8. To allow connections from a wider range of IP 34 addresses, change the CIDR IP ranges specified under the 35 `loadBalancerSourceRanges` field in galera.yaml, then run `kubectl apply -f 36 galera.yaml`. 37 38 ## Derivation 39 40 Based on 41 [the mysql-galera example from the Kubernetes GitHub repository](https://github.com/kubernetes/kubernetes/tree/v1.5.4/examples/storage/mysql-galera), 42 which is available under 43 [the Apache 2.0 license](https://github.com/kubernetes/kubernetes/blob/v1.5.4/LICENSE). 44 45 The following modifications have been made: 46 - Increased CPU limit per replica to 2. 47 - Each instance will use a persistent SSD for storage of its database. 48 - The cluster will be managed as a 49 [StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/). 50 - The cluster is accessed via a load balancer, enabling a transparent 51 multi-master setup. 52 - Updated image to use Percona 5.7. 53 - Simplified scripts by removing unnecessary options. 54 - Added some utility scripts: 55 - image/env.sh 56 - image/push.sh 57 - Added readiness probes to the Kubernetes config. 58 - Moved usernames and passwords into [Secrets](https://kubernetes.io/docs/concepts/configuration/secret/).