This tutorial is a walk-through of how to failover MySQL on Google Kubernetes Engine (GKE)…
February 24, 2022
Choosing a Kubernetes Operator for MySQL
Choosing a Kubernetes Operator for MySQL
Managing stateful applications like caches and databases running on Kubernetes is a tough task. With the Kubernetes API, you can build self-managing infrastructure by encoding operational knowledge and practices directly into code on demand. For example, when a MySQL container pod fails, you can use an operator to respond and take the appropriate action to bring the system back to life.
Operators are controllers built on top of Kubernetes that automate and streamline domain-specific and complex operations. They exist to provide exceptional scalability, as well as high availability and monitoring capabilities to end-users.
Running databases in Kubernetes becomes seamless with operators since they bridge the gap between stateful databases and stateless applications running in Kubernetes. They make it easier to package, deploy, and manage production-ready MySQL clusters with the use of a declarative configuration format. They also help with backup, scaling, and restoring, and they can run anywhere inside the existing Kubernetes cluster.
There are quite a few solutions for MySQL operators that make running MySQL on Kubernetes a pleasant experience. These include Oracle, Percona, Bitpoke, and GrdsCloud. Out of these, which ones are more stable? Which ones are faster? Which ones offer better functionalities?
In this blog post, we’ll compare these top-grade MySQL Operators for Kubernetes and summarize the features that differentiate them. Let’s get started.
Official Oracle MySQL Operator
Oracle MySQL Operator is a stable and reliable database management system that’s often considered as a default installation for popular web hosts, including WordPress.
Key features of Oracle MySQL Operator include the following:
- Self-healing solution: Oracle MySQL Operator can create and scale MySQL InnoDB clusters running in Kubernetes. It leverages the Group Replication plugin to create fault-tolerant groups that can run in a single-primary mode where, at any given time, only a single server will approve upgrades. These groups can also operate in a multi-primary mode, where all servers will concurrently accept upgrades. This multi-master replication plugin offers great update-anywhere benefits along with built-in conflict identification and resolution, group membership, and automatically distributed recovery abilities.
- Backup and restore: Create backups on-demand or use the scheduler feature for automatic backup databases to Object Storage at a preset time. Users can also restore a database from an existing backup.
- Architecture: Leverage InnoDB and Group Replication to create and scale MySQL clusters on Kubernetes. In case the cluster instances die, the MySQL Operator will automatically recover them into the cluster. Kubernetes Persistent Volume Claims allows you to store data on network linked storage or local disk.
- Performance: It uses Custom Resource Definitions for extending the Kubernetes API. MySQL Operator users can interact using these third-party resource objects.
- Ease of use: Creating a MySQL Cluster using this operator is a breeze. Simply define the YAML file and use kubectl to directly submit it to Kubernetes. The operator will watch for MySQL Cluster resources and take steps to create a MySQL cluster.
The documentation for Oracle MySQL Operator is quite comprehensive as well. For security, it supports access from a private registry.
Oracle MySQL Operator is a simple, straightforward Kubernetes controller that closely monitors the API Server to look for custom resource definitions linked to MySQL and takes actions accordingly. It uses Prometheus metrics for monitoring and alerting. The only downside is that the backup can only be stored on S3 or S3 compatible storage.
With the right management and monitoring solution in place, leveraging Kubernetes gets even easier. Learn more about how to use Oracle MySQL Operator with Portworx.
Percona MySQL is a comprehensive operator that provides support for highly demanding, resource-intensive applications. It offers various performance optimization tools along with XtraDB as its storage engine. XtraBackup and XtraDB Cluster offer numerous tools compatible with this engine to make daily admin tasks easier for DBAs.
Key features of Percona MySQL Operator are:
- Deploy and Scale: You can create a Percona XtraDB Cluster environment spanning multiple availability zones without any point of failure. For scalability, you can change the size parameter to add or delete the XtraDB cluster members.
- Security: Percona offers strong security features, like automated password rotation, data encryption in transit, and support for private registry access.
- Architecture: Percona XtraDB Cluster offers synchronous multi-primary replication by integrating Percona Server for MySQL with XtraDB engine and Percona XtraBackup with the Galera library.
Here’s a quick overview of Percona’s architecture. Using node affinity, the operator provides high availability by running Percona XtraDB Cluster instances over separate nodes. In case a node fails, a pod is automatically re-joined on another node.
Similarly, it uses PVC (PersistentVolumeChain) to automate storage provisioning to pods.
The documentation for Percona MySQL Operator is well detailed compared to other operators.
Bitpoke MySQL Operator manages all essential resources for deployment and management of highly available MySQL clusters in Kubernetes (cluster-per-service model). Additionally, it also helps streamline database operations like scaling, backup, and failover. To suit your use case, you can create one cluster for multiple sites or one cluster per site.
Bitpoke MySQL Operator is DevOps-friendly, meaning that it streamlines monitoring, scalability, availability, and backup processes. It supports point-in-time recovery and backups (on-demand and scheduled), and also supports cloning within and across clusters.
Bitpoke MySQL Operator key benefits include:
- Architecture: The Bitpoke MySQL Operator uses Percona Server and Openark’s Orchestrator to provide asynchronous MySQL replication on Kubernetes.
- Ease of use: Getting started with Bitpoke MySQL Operator is simple and quick. Users simply need to have access to a Kubernetes cluster with Helm and kubectl installed.
With the help of this README chart, you can deploy the controller along with an orchestrator cluster. The documentation for Bitpoke MySQL Operator is fairly sufficient. When it comes to security, Bitpoke, unfortunately, lacks solid security features: It only offers SSL support.
GrdsCloud MySQL Operator helps you run stateless MySQL in container-based environments such as Kubernetes. You don’t need to change the rights of MySQL databases, so managing and scaling production-ready MySQL clusters becomes way easier.
Key features of GrdsCloud MySQL Operator are:
- Easy to build: Once the GrdsCloud MySQL Operator is installed, you can quickly build and manage containerized MySQL clusters running in Kubernetes. This can be done with the help of basic declarative configurations. Users can easily define parameters for the cpu/io/memory formats.
- Disaster Recovery: This controller includes media recovery and a backup task scheduler to make daily database admin activities easier.
- High Availability: It runs fully automated database inspection to identify failures. Changes that occur within the database are logged in binary logs in real-time. The MySQL Operator will handle these updates and automatically re-execute or repair binary logs in case of database failure. Depending on the circumstance, it will assign a new primary instance. This will help users attain a highly-available MySQL cluster.
- SlowSQL Analyst: To derive valuable insights, Grds MySQL Operator automatically collects and analyzes application SQL and accordingly provides optimization suggestions.
The documentation for GrdsCloud is not detailed compared to the others. Additionally, GrdsCloud lacks powerful security features for sensitive data in transit. It’s a good operator, but it doesn’t support deep insights and AutoPilot capabilities.
Running a MySQL cluster on Kubernetes isn’t as simple as it sounds — especially beyond just scaling and provisioning. That’s why using an operator is extremely useful, as it automates these processes for end-users. The best choice for your applications ultimately relies upon the scale, resource, and size demands of your database. Sometimes, it also comes down to the DBA’s taste.
Portworx offers a robust Database-as-a-Service (DBaaS) platform call Portworx Data Sevices (PDS) for Kubernetes to help DevOps engineers effortlessly deploy managed, highly available, and production-ready MySQL clusters in Kubernetes. Portworx fully automates critical operations including MySQL migration, monitoring, recovery, security, scaling, backups, and more. Check out Portworx Data Services to learn more about using MySQL with Portworx.