mariadb
by CloudPirates
MariaDB is a high-performance, open-source relational database server that is a drop-in replacement for MySQL. Supports both single-node and Galera Cluster deployments.
About this chart
MariaDB
MariaDB is a high-performance, open-source relational database server that is a drop-in replacement for MySQL. This Helm chart deploys MariaDB as a StatefulSet on Kubernetes with comprehensive configuration options for development and production environments, providing stable network identities and persistent storage.
The chart supports both single-node deployments and multi-node Galera cluster configurations for high availability and automatic failover.
Installing the Chart
To install the chart with the release name my-mariadb:
helm install my-mariadb oci://registry-1.docker.io/cloudpirates/mariadb
To install with custom values:
helm install my-mariadb oci://registry-1.docker.io/cloudpirates/mariadb -f my-values.yaml
Or install directly from the local chart:
helm install my-mariadb ./charts/mariadb
Uninstalling the Chart
To uninstall/delete the my-mariadb deployment:
helm uninstall my-mariadb
This removes all the Kubernetes components associated with the chart and deletes the release.
Security & Signature Verification
This Helm chart is cryptographically signed with Cosign to ensure authenticity and prevent tampering.
Public Key:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5U+rM2d3hDjgP5T3cLShuuQIU9vR
Z4/G+Nug6q5vRa+C3qUA1wXjbaJFAfcIrv5VjmYAYOj13shnPpp3Zh4fnQ==
-----END PUBLIC KEY-----
To verify the helm chart before installation, copy the public key to the file cosign.pub and run cosign:
cosign verify --key cosign.pub registry-1.docker.io/cloudpirates/mariadb:<version>
StatefulSet Features
This chart deploys MariaDB as a StatefulSet, which provides several advantages for stateful workloads:
- Stable Network Identities: Each pod gets a predictable hostname (e.g.,
mariadb-0,mariadb-1) - Ordered Deployment: Pods are created, updated, and terminated in order
- Persistent Storage: Each pod gets its own persistent volume that persists across restarts
- Headless Service Support: Can be configured with a headless service for direct pod communication
Persistent Storage
The StatefulSet uses volumeClaimTemplates to automatically create persistent volumes for each pod instance. This means:
- Each pod gets its own dedicated storage
- Storage persists even if the pod is rescheduled
- No separate PVC needs to be created manually
Headless Service Configuration
To enable headless service (useful for database clustering), set:
service:
clusterIP: "None"
Configuration
The following table lists the configurable parameters of the MariaDB chart and their default values.
Global Parameters
| Parameter | Description | Default |
|---|---|---|
global.imageRegistry | Global Docker Image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
Common Parameters
| Parameter | Description | Default |
|---|---|---|
nameOverride | String to partially override mariadb.fullname | "" |
fullnameOverride | String to fully override mariadb.fullname | "" |
namespaceOverride | String to override the namespace for all resources | "" |
commonLabels | Labels to add to all deployed objects | {} |
commonAnnotations | Annotations to add to all deployed objects | {} |
MariaDB Image Parameters
| Parameter | Description | Default |
|---|---|---|
image.registry | MariaDB image registry | docker.io |
image.repository | MariaDB image repository | mariadb |
image.tag | MariaDB image tag (immutable tags are recommended) | "12.1.2@sha256:e1bcd6f85781f4a875abefb11c4166c1d79e4237c23de597bf0df81fec225b40" |
image.pullPolicy | MariaDB image pull policy | IfNotPresent |
MariaDB Authentication Parameters
| Parameter | Description | Default |
|---|---|---|
auth.enabled | MariaDB authentication enabled or disabled | "true" |
auth.rootPassword | MariaDB root password | "" |
auth.database | MariaDB custom database | "" |
auth.username | MariaDB custom user name | "" |
auth.password | MariaDB custom user password | "" |
auth.existingSecret | Name of existing secret to use for MariaDB credentials | "" |
auth.auth.allowEmptyRootPassword | Allow the root user of MariaDB to have no password set | "" |
auth.secretKeys.rootPasswordKey | Name of key in existing secret to use for root password | mariadb-root-password |
auth.secretKeys.userPasswordKey | Name of key in existing secret to use for user password | mariadb-password |
MariaDB Configuration Parameters
| Parameter | Description | Default |
|---|---|---|
config.customConfiguration | Custom configuration for MariaDB | "" |
config.existingConfigMap | Name of existing ConfigMap with MariaDB configuration | "" |
Galera Cluster Parameters
For a detailed explanation of Galera parameters and usage, see README_GALERA.md.
[!WARNING]
You must migrate from a standalone MariaDB to Galera carefully. Do not enable Galera on an existing standalone database without following proper migration steps.
| Parameter | Description | Default |
|---|---|---|
galera.enabled | Enable Galera Cluster mode | false |
galera.name | Galera cluster name | "galera" |
galera.bootstrap.enabled | Enable bootstrap mode for the first node in the cluster | true |
galera.replicaCount | Number of nodes in the Galera cluster | 3 |
galera.wsrepProvider | Path to wsrep provider library | /usr/lib/galera/libgalera_smm.so |
galera.wsrepMethod | Method for state snapshot transfers (mariabackup, mysqldump, rsync) | mariabackup |
galera.forceSafeToBootstrap | Force safe_to_bootstrap=1 in grastate.dat | false |
galera.wsrepSlaveThreads | Number of slave threads for applying writesets | 1 |
galera.wsrepCertifyNonPK | Require primary key for replication | true |
galera.wsrepMaxWsRows | Maximum number of rows in writeset | 0 |
galera.wsrepMaxWsSize | Maximum size of writeset in bytes | 1073741824 |
galera.wsrepDebug | Enable wsrep debugging | false |
galera.wsrepRetryAutocommit | Number of times to retry autocommit | 1 |
galera.wsrepAutoIncrementControl | Enable auto increment control | true |
galera.wsrepDrupalHack | Enable Drupal compatibility hack | false |
galera.wsrepLogConflicts | Log conflicts to error log | false |
galera.innodb.flushLogAtTrxCommit | InnoDB flush log at transaction commit | 0 |
galera.innodb.bufferPoolSize | InnoDB buffer pool size | "128M" |
galera.sst.user | SST user for authentication | "sstuser" |
galera.sst.password | SST password for authentication | "" |
galera.sst.existingSecret | Existing secret containing SST credentials | "" |
galera.sst.secretKeys.userKey | Secret key for SST user | sst-user |
galera.sst.secretKeys.passwordKey | Secret key for SST password | sst-password |
galera.recovery.enabled | Enable automatic recovery | true |
galera.recovery.clusterBootstrap | Enable cluster bootstrap in recovery | true |
Service Parameters
| Parameter | Description | Default |
|---|---|---|
service.type | MariaDB service type | ClusterIP |
service.port | MariaDB service port | 3306 |
service.nodePort | Node port for MariaDB service | "" |
service.clusterIP | Static cluster IP or "None" for headless service | "" |
service.annotations | Additional custom annotations for MariaDB service | {} |
Persistence Parameters
| Parameter | Description | Default |
|---|---|---|
persistence.enabled | Enable MariaDB data persistence using PVC | true |
persistence.existingClaim | Name of an existing PVC to use for MariaDB data volume | "" |
persistence.storageClass | PVC Storage Class for MariaDB data volume | "" |
persistence.accessModes | PVC Access modes | ["ReadWriteOnce"] |
persistence.size | PVC Storage Request for MariaDB data volume | 8Gi |
persistence.annotations | Additional custom annotations for the PVC | {} |
persistence.labels | Labels for persistent volume claims | {} |
persistence.selector | Additional labels for the PVC | {} |
Security Context Parameters
| Parameter | Description | Default |
|---|---|---|
podSecurityContext.fsGroup | Set MariaDB pod's Security Context fsGroup | 999 |
containerSecurityContext.runAsUser | Set MariaDB container's Security Context runAsUser | 999 |
containerSecurityContext.runAsNonRoot | Set MariaDB container's Security Context runAsNonRoot | true |
containerSecurityContext.allowPrivilegeEscalation | Set MariaDB container's privilege escalation | false |
containerSecurityContext.readOnlyRootFilesystem | Set MariaDB container's Security Context readOnlyRootFilesystem | false |
priorityClassName | Priority class for the MariaDB instance | "" |
Resources Paramete
Deploy mariadb with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mariadb on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmariadb is pinned at v0.17.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply