Automating MySQL Deployments on Kubernetes Calin Don & Flavius Mecea Presslabs
Automating MySQL Deployments on Kubernetes Percona Live 2018
00. Who are we? Calin Don Flavius Mecea Co-founder & CTO Project Lead @Presslabs @Presslabs
01. Context 02. The Need 03. Solution 04. Use cases 05. Outcomes 06. Demo 07. Project status 08. Future plans
01. Context
01. Context 2007 2011 2013 2015 2018 WordPress Managed Record: 2,2 BN Top tier in Open-Source development WordPress pageviews in a Enterprise Stack agency hosting month hosting
01. Context / Why Kubernetes? Ubiquitous technology ● Open-source ● The core of our Stack ●
02. The Need
02. The Need 1. Easy MySQL Cluster deployment in Kubernetes 2. Scalable MySQL Cluster* 3. High availability for MySQL 4. Automated backups & restore 5. Built-in monitoring
03. The Need didn’t fit our scaling model didn’t provide enough automation
03. Solution
03. Solution Kubernetes Operator for managing MySQL Clusters with asynchronous or semi-synchronous replication. Self-healing clusters ● Highly available reads ● Virtually highly available writes ● Replication lag detection and mitigation ● Resource abuse control ● Automated backups and restores ●
03. Solution How it’s made
03. Solution Node internals
03. Solution Percona is battle-tested in Enterprise environments. NOW UPCOMING ● Percona XtraBackup Percona Monitoring & Management ● ● Percona Toolkit ● Percona Server for MySQL
04. Use Cases
04. Use Cases Microservices ● Ephemeral databases for testing ● On-premise DBaaS ●
05. Outcomes
05. Outcomes / Evaluation setup ~ $50 ~ $50
05. Outcomes / Evaluation setup Target performance vs required resources QPS
05. Outcomes / Evaluation setup Target performance vs required resources QPS
05. Outcomes / Evaluation setup Target performance vs required resources QPS
05. Outcomes / Evaluation setup Target performance vs required resources QPS
05. Outcomes / Evaluation setup Target performance vs required resources QPS
05. Outcomes / Costs ~ $250 ~ $50
Calin Don
06. Demo time!
Demo - install MySQL Operator $ helm repo add presslabs https://presslabs.github.io/charts $ helm install presslabs/mysql-operator --name mysql-operator
Demo - install MySQL Operator $ helm repo add presslabs https://presslabs.github.io/charts $ helm install presslabs/mysql-operator --name mysql-operator NAME: mysql-operator LAST DEPLOYED: Fri Nov 2 12:09:24 2018 NAMESPACE: default STATUS: DEPLOYED ...
Demo - create a cluster cluster.yaml apiVersion: v1 kind: Secret metadata: name: test-secret type: Opaque data: ROOT_PASSWORD: bm90LXNvLXNlY3VyZQ== # USER: # PASSWORD: # DATABASE: --- apiVersion: mysql.presslabs.org/v1alpha1 kind: MysqlCluster metadata: name: test spec: replicas: 1 secretName: test-secret
Demo - create a cluster $ kubectl apply -f cluster.yaml secret/test-secret created mysqlcluster.mysql.presslabs.org/test created $ kubectl get pods NAME READY STATUS RESTARTS AGE test-mysql-0 4/4 Running 2 4m
Demo - create a cluster $ kubectl describe mysqlcluster test ... Status: Conditions: Status: True Type: Ready Ready Nodes: 1 Nodes: Name: test-mysql-0.test-mysql-nodes.default Conditions: - Type: Lagged Status: Unknown - Type: Replicating Status: False - Type: Master Status: True - Type: ReadOnly Status: False
Demo - connect to cluster $ kubectl port-forward svc/test-mysql-master 3306 & Forwarding from 127.0.0.1:3306 -> 3306 Forwarding from [::1]:3306 -> 3306 $ mysql --host=localhost -u app-user -papp-password If you don't see a command prompt, try pressing enter. mysql> SELECT @@hostname; +--------------+ | @@hostname | +--------------+ | test-mysql-0 | +--------------+ 1 row in set (0.01 sec)
Demo - scale up cluster.yaml apiVersion: mysql.presslabs.org/v1alpha1 kind: MysqlCluster metadata: name: test spec: replicas: 2 secretName: test-secret
Demo - scale up $ kubectl apply -f cluster.yaml mysqlcluster.mysql.presslabs.org/test updated
07. Project status
07. Project status ~ 250 commits, ~ 60 closed PRs 2 nd rewrite, version 0.2.0 - is almost complete Community Contributors
08. Future Plans
08. Future Plans Logical mysqldump backups ● Point in time backup and restore ● Integrate Percona Management & Monitoring ● Kubernetes Service Catalog integration ● ProxySQL integration ● Vault integration ● GUI ●
Contribute! www.github.com/presslabs/mysql-operator
Recommend
More recommend