mariadb

by CloudPirates

Helm chartv0.17.1App 13.0.2Apache-2.0Verified publisher

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

ParameterDescriptionDefault
global.imageRegistryGlobal Docker Image registry""
global.imagePullSecretsGlobal Docker registry secret names as an array[]

Common Parameters

ParameterDescriptionDefault
nameOverrideString to partially override mariadb.fullname""
fullnameOverrideString to fully override mariadb.fullname""
namespaceOverrideString to override the namespace for all resources""
commonLabelsLabels to add to all deployed objects{}
commonAnnotationsAnnotations to add to all deployed objects{}

MariaDB Image Parameters

ParameterDescriptionDefault
image.registryMariaDB image registrydocker.io
image.repositoryMariaDB image repositorymariadb
image.tagMariaDB image tag (immutable tags are recommended)"12.1.2@sha256:e1bcd6f85781f4a875abefb11c4166c1d79e4237c23de597bf0df81fec225b40"
image.pullPolicyMariaDB image pull policyIfNotPresent

MariaDB Authentication Parameters

ParameterDescriptionDefault
auth.enabledMariaDB authentication enabled or disabled"true"
auth.rootPasswordMariaDB root password""
auth.databaseMariaDB custom database""
auth.usernameMariaDB custom user name""
auth.passwordMariaDB custom user password""
auth.existingSecretName of existing secret to use for MariaDB credentials""
auth.auth.allowEmptyRootPasswordAllow the root user of MariaDB to have no password set""
auth.secretKeys.rootPasswordKeyName of key in existing secret to use for root passwordmariadb-root-password
auth.secretKeys.userPasswordKeyName of key in existing secret to use for user passwordmariadb-password

MariaDB Configuration Parameters

ParameterDescriptionDefault
config.customConfigurationCustom configuration for MariaDB""
config.existingConfigMapName 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.

ParameterDescriptionDefault
galera.enabledEnable Galera Cluster modefalse
galera.nameGalera cluster name"galera"
galera.bootstrap.enabledEnable bootstrap mode for the first node in the clustertrue
galera.replicaCountNumber of nodes in the Galera cluster3
galera.wsrepProviderPath to wsrep provider library/usr/lib/galera/libgalera_smm.so
galera.wsrepMethodMethod for state snapshot transfers (mariabackup, mysqldump, rsync)mariabackup
galera.forceSafeToBootstrapForce safe_to_bootstrap=1 in grastate.datfalse
galera.wsrepSlaveThreadsNumber of slave threads for applying writesets1
galera.wsrepCertifyNonPKRequire primary key for replicationtrue
galera.wsrepMaxWsRowsMaximum number of rows in writeset0
galera.wsrepMaxWsSizeMaximum size of writeset in bytes1073741824
galera.wsrepDebugEnable wsrep debuggingfalse
galera.wsrepRetryAutocommitNumber of times to retry autocommit1
galera.wsrepAutoIncrementControlEnable auto increment controltrue
galera.wsrepDrupalHackEnable Drupal compatibility hackfalse
galera.wsrepLogConflictsLog conflicts to error logfalse
galera.innodb.flushLogAtTrxCommitInnoDB flush log at transaction commit0
galera.innodb.bufferPoolSizeInnoDB buffer pool size"128M"
galera.sst.userSST user for authentication"sstuser"
galera.sst.passwordSST password for authentication""
galera.sst.existingSecretExisting secret containing SST credentials""
galera.sst.secretKeys.userKeySecret key for SST usersst-user
galera.sst.secretKeys.passwordKeySecret key for SST passwordsst-password
galera.recovery.enabledEnable automatic recoverytrue
galera.recovery.clusterBootstrapEnable cluster bootstrap in recoverytrue

Service Parameters

ParameterDescriptionDefault
service.typeMariaDB service typeClusterIP
service.portMariaDB service port3306
service.nodePortNode port for MariaDB service""
service.clusterIPStatic cluster IP or "None" for headless service""
service.annotationsAdditional custom annotations for MariaDB service{}

Persistence Parameters

ParameterDescriptionDefault
persistence.enabledEnable MariaDB data persistence using PVCtrue
persistence.existingClaimName of an existing PVC to use for MariaDB data volume""
persistence.storageClassPVC Storage Class for MariaDB data volume""
persistence.accessModesPVC Access modes["ReadWriteOnce"]
persistence.sizePVC Storage Request for MariaDB data volume8Gi
persistence.annotationsAdditional custom annotations for the PVC{}
persistence.labelsLabels for persistent volume claims{}
persistence.selectorAdditional labels for the PVC{}

Security Context Parameters

ParameterDescriptionDefault
podSecurityContext.fsGroupSet MariaDB pod's Security Context fsGroup999
containerSecurityContext.runAsUserSet MariaDB container's Security Context runAsUser999
containerSecurityContext.runAsNonRootSet MariaDB container's Security Context runAsNonRoottrue
containerSecurityContext.allowPrivilegeEscalationSet MariaDB container's privilege escalationfalse
containerSecurityContext.readOnlyRootFilesystemSet MariaDB container's Security Context readOnlyRootFilesystemfalse
priorityClassNamePriority 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmariadb is pinned at v0.17.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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