Running MySQL in Kubernetes / Openshift

Vadim Tkachenko
Vadim Tkachenko co-founded Percona in 2006 and serves as its Chief Technology Officer. He leads Percona CTO Labs, which focuses on technology research and performance evaluations of Percona and third-party products, designing hardware, filesystems, storage engines, and databases that surpass the standard performance and functionality scenario benchmarks. Under his supervision, Percona has developed and shipped Percona Server for MySQL, Percona XtraBackup, Percona XtraDB Cluster, Percona Server for MongoDB. Vadim’s expertise in LAMP performance and multi-threaded programming help optimize MySQL and InnoDB internals to take full advantage of modern hardware. Oracle Corporation and its predecessors have incorporated Vadim’s source code patches into the mainstream MySQL and InnoDB products. Prior to joining Percona, Vadim served as Performance Engineer at MySQL AB as well as founded a web development company in his native Ukraine. He also spent two years in the High-Performance Group within the official MySQL support team. In addition, Vadim has also co-authored the book High-Performance MySQL: Optimization, Backups, and Replication, 3rd Edition. Vadim received a BS in Economics and an MS in Computer Science from the National Technical University of Ukraine, and lives in North Carolina with his wife and two children.


1.Running MySQL in Kubernetes / Openshift Vadim Tkachenko, CTO, Percona

2. What is Kubernetes? Kubernetes is a portable, extensible open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation.

3. What is Kubernetes? (my version) Kubernetes is a way to “automagically” manage data center resources requested to run applications and tasks Kubernetes is an Operating System for multiple computing, networking, and storage resources

4.Why Kubernetes? ● Cloud Agnostic ○ Unified API ● A standard supported by multiple cloud and software vendors ● Based on modern container-based deployment

5.Massive support from the industry leaders ● OpenShift from RedHat ● Amazon Elastic Container Service for Kubernetes ● Google Kubernetes Engine ● Azure Kubernetes Service ● Pivotal Kubernetes Service ● Digital Ocean Kubernetes (Early Access) ● 35+ public distributions of Kubernetes on the market

6.Let’s look under the hood

7.Kubernetes Node

8.Kubernetes Nodes

9.Properties ● Container can be destroyed and restarted automatically ● POD can be destroyed and restarted on a different Node ● POD can be multiplied - scaling out ● Great for “stateless” application, e.g. web server ● No so great for databases ○ We want to keep our data

10.Databases as first class citizens ● Made possible with ○ Stateful Sets ○ Persistent Storage


12.MySQL In Kubernetes ● A single instance is easy ○ instance-stateful-application/

13.A complex setup is … more complex ● High Availability ● Persistent Storage ● Backup and recovery ● Traffic routing ● Monitoring


15.Disclaimer ● The further information is based on our Proof Of Concept ● Use it as a guidance for your own setup, not as a production ready product ●


17.Replication Options ● Traditional MySQL replication ● Group Replication ● Percona XtraDB Cluster

18.Traditional Replication challenges ● No automatic failover ○ New master detection can be quite complicated ● No automatic slave setup

19.Group Replication ● Not mature enough ● Still no automatic slave setup

20.What is Percona XtraDB Cluster (PXC)?

21.Why PXC? Auto provisioning...

22.PXC: Data transfer


24.Storage options ● Local storage ○ Can be fast (SSD, NVMe options) ○ Still limited management capabilities in Kubernetes ● Network storage ○ Management and Flexibility if supported by your setup ■ Supported by major cloud providers ○ On-premise setup may require Ceph or SAN ○ The dynamic provision of persistent volumes is required

25.Traffic routing

26.Traffic routing ● ProxySQL ○ High-performance MySQL proxy ○ Query Routing ○ Supports Failover

27.What is ProxySQL?

28.ProxySQL read/write split Query routing is one of the core features of ProxySQL. Read/write split is perhaps one of the most common query routing use

29.ProxySQL read-write split