> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/server-management/automated-mariadb-deployment-and-administration/kubernetes-and-mariadb/kubernetes-operators-for-mariadb.md).

# 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](https://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](/docs/server/ha-and-performance/standard-replication.md)), 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.

{% hint style="success" %}
Find the [documentation here](/docs/tools/mariadb-enterprise-operator.md).
{% endhint %}

## MariaDB Community Operator

[mariadb-operator](https://github.com/mariadb-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](https://artifacthub.io/packages/helm/mariadb-operator/mariadb-operator) and [Operator Hub](https://operatorhub.io/operator/mariadb-operator) and supports the following features:

* Easily provision [standalone MariaDB servers](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/standalone.md) in Kubernetes.
* Multiple [highly available](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/high_availability.md) topologies supported:
  * [Asynchronous replication](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/replication.md)
  * [Synchronous multi-master via Galera](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/galera.md)
  * [Multi-cluster](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/multi-cluster.md): cross-cluster replication for multi-region deployments, disaster recovery, and blue-green upgrades.
  * [MaxScale](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/maxscale.md) as database proxy to load balance requests and perform failover/switchover operations
* Flexible [storage](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/storage.md) configuration. [Volume expansion](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/storage.md#volume-resize).
* [Physical backups](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md) based on [mariadb-backup](https://mariadb.com/docs/server/server-usage/backup-and-restore/mariadb-backup/full-backup-and-restore-with-mariadb-backup) and [Kubernetes VolumeSnapshots](https://kubernetes.io/docs/concepts/storage/volume-snapshots/).
* [Logical backups](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/logical_backup.md) based on [mariadb-dump](https://mariadb.com/docs/server/clients-and-utilities/backup-restore-and-import-clients/mariadb-dump).
* Multiple [backup storage types](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#storage-types): S3 compatible, Azure Blob Storage, PVCs, Kubernetes volumes and `VolumeSnapshots`.
* Flexible backup configuration: [scheduling](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#scheduling), [compression](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#compression), [encryption](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#server-side-encryption-with-customer-provided-keys-sse-c), [retention policy](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#retention-policy), [target policy](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#target-policy), [timeout](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#timeout), [staging area](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#staging-area)...
* [Target recovery time](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#target-recovery-time): restore the closest available backup to the specified time.
* [Bootstrap new instances](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/physical_backup.md#restoration) from: Physical backups, logical backups, S3, Azure Blob Storage, PVCs, `VolumeSnapshots`...
* [Point-In-Time-Recovery](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/pitr.md): Archive binary logs to enable point-in-time restoration and significantly reduce RPO.
* [Cluster-aware rolling update](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/updates.md#replicasfirstprimarylast): roll out replica Pods one by one, wait for each of them to become ready, and then proceed with the primary Pod, using `ReplicasFirstPrimaryLast`.
* Zero-downtime blue-green updates: leverage the [multi-cluster topology](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/multi-cluster.md) to maintain two identical cluster topologies, upgrade one in the background, and switch between them without downtime.
* Manual [update strategies](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/updates.md#update-strategies): `OnDelete` and `Never`.
* Automated [data-plane updates](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/updates.md#auto-update-data-plane).
* [my.cnf change detection](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/configuration.md#mycnf). Automatically trigger [updates](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/updates.md) when my.cnf changes.
* [Suspend](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/suspend.md) operator reconciliation for maintenance operations.
* [Maintenance mode](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/maintenance.md) for safe operational windows: cordon, drain connections, and read-only modes.
* Issue, configure and rotate [TLS certificates](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/tls.md) and CAs.
* Automated [root password rotation](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/security.md#root-password-rotation) by updating the referenced `Secret`.
* Native integration with [cert-manager](https://github.com/cert-manager/cert-manager). Automatically create `Certificate` resources.
* [Prometheus metrics](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/metrics.md) via [mysqld-exporter](https://github.com/prometheus/mysqld_exporter) and maxscale-exporter.
* Native integration with [prometheus-operator](https://github.com/prometheus-operator/prometheus-operator). Automatically create `ServiceMonitor` resources.
* Declaratively manage [SQL resources](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/sql_resources.md): [users](https://github.com/mariadb-operator/mariadb-operator/blob/main/examples/manifests/user.yaml), [grants](https://github.com/mariadb-operator/mariadb-operator/blob/main/examples/manifests/grant.yaml) and logical [databases](https://github.com/mariadb-operator/mariadb-operator/blob/main/examples/manifests/database.yaml).
* Declaratively manage resources in [external MariaDB instances](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/external_mariadb.md).
* Configure [connections](https://github.com/mariadb-operator/mariadb-operator/blob/main/examples/manifests/connection.yaml) for your applications.
* Orchestrate and schedule [sql scripts](https://github.com/mariadb-operator/mariadb-operator/blob/main/examples/manifests/sqljobs).
* Validation webhooks to provide CRD immutability.
* Additional printer columns to report the current CRD status.
* CRDs designed according to the Kubernetes [API conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md).
* Install it using [helm](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/helm.md), [OLM](https://operatorhub.io/operator/mariadb-operator) or [static manifests](https://github.com/mariadb-operator/mariadb-operator/blob/main/deploy/manifests).
* Multiple [deployment modes](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/helm.md#deployment-modes): cluster-wide and single namespace.
* Helm charts published as [OCI artifacts](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/helm.md#oci-based-installation).
* Helm chart to deploy [MariaDB clusters](https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/helm.md#mariadb-cluster-helm-chart) and its associated CRs.
* Multi-arch distroless [image](https://github.com/orgs/mariadb-operator/packages/container/package/mariadb-operator).
* GitOps friendly.

Please, refer to the [documentation](https://github.com/mariadb-operator/mariadb-operator/tree/main/docs/README.md), the [API reference](https://github.com/mariadb-operator/mariadb-operator/tree/main/docs/api_reference.md) and the [example suite](https://github.com/mariadb-operator/mariadb-operator/blob/main/examples/manifests) for further detail.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mariadb.com/docs/server/server-management/automated-mariadb-deployment-and-administration/kubernetes-and-mariadb/kubernetes-operators-for-mariadb.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
