Kubernetes Operators for MariaDB
Operators basically instruct Kubernetes about how to manage a certain technology. Kubernetes comes with some default operators, but it is possible to create custom operators. Operators created by the community can be found on OperatorHub.io.
Custom Operators
Kubernetes provides a declarative API. To support a specific (i.e. MariaDB) technology or implement a desired behavior (i.e. provisioning a replica), we extend Kubernetes API. This involves creating two main components:
A custom resource.
A custom controller.
A custom resource adds an API endpoint, so the resource can be managed via the API server. It includes functionality to get information about the resource, like a list of the existing servers.
A custom controller implements the checks that must be performed against the resource to check if its state should be corrected using the API. In the case of MariaDB, some reasonable checks would be verifying that it accepts connections, replication is running, and a server is (or is not) read only.
MariaDB Enterprise Operator
MariaDB Enterprise Operator provides a seamless way to run and operate containerized versions of MariaDB Enterprise Server and MaxScale on Kubernetes, allowing you to leverage Kubernetes orchestration and automation capabilities. This document outlines the features and advantages of using Kubernetes and the MariaDB Enterprise Operator to streamline the deployment and management of MariaDB and MaxScale instances.
Find the documentation here.
MariaDB Community Operator
mariadb-operator is a Kubernetes operator that allows you to run and operate MariaDB in a cloud native way. It aims to declaratively manage MariaDB instances using Kubernetes CRDs instead of imperative commands.
It's available in both Artifact Hub and Operator Hub and supports the following features:
Easily provision and configure MariaDB servers in Kubernetes.
Multiple HA modes: Galera Cluster or MariaDB Replication.
Automated Galera primary failover and cluster recovery.
Advanced HA with MaxScale: a sophisticated database proxy, router, and load balancer for MariaDB.
Flexible storage configuration. Volume expansion.
Physical backups based on mariadb-backup and Kubernetes VolumeSnapshots.
Logical backups based on mariadb-dump.
Multiple backup storage types: S3 compatible, PVCs, Kubernetes volumes and
VolumeSnapshots
.Flexible backup configuration: scheduling, compression, retention policy, timeout, staging area...
Target recovery time: restore the closest available backup to the specified time.
Bootstrap new instances from: Physical backups, logical backups, S3, PVCs,
VolumeSnapshots
...Cluster-aware rolling update: roll out replica Pods one by one, wait for each of them to become ready, and then proceed with the primary Pod, using
ReplicasFirstPrimaryLast
.Manual update strategies:
OnDelete
andNever
.Automated data-plane updates.
my.cnf change detection. Automatically trigger updates when my.cnf changes.
Suspend operator reconciliation for maintenance operations.
Issue, configure and rotate TLS certificates and CAs.
Native integration with cert-manager. Automatically create
Certificate
resources.Prometheus metrics via mysqld-exporter and maxscale-exporter.
Native integration with prometheus-operator. Automatically create
ServiceMonitor
resources.Declaratively manage SQL resources: users, grants and logical databases.
Configure connections for your applications.
Orchestrate and schedule sql scripts.
Validation webhooks to provide CRD immutability.
Additional printer columns to report the current CRD status.
CRDs designed according to the Kubernetes API conventions.
Install it using helm, OLM or static manifests.
Multiple deployment modes: cluster-wide and single namespace.
Helm chart to deploy MariaDB clusters and its associated CRs.
Multi-arch distroless image.
GitOps friendly.
Please, refer to the documentation, the API reference and the example suite for further detail.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?