mariadb

by groundhog2k

Helm chartv4.44.0App 11.8.4

A Helm chart for MariaDB on Kubernetes

About this chart

MariaDB

Changelog

see RELEASENOTES.md

A Helm chart for MariaDB on Kubernetes

TL;DR

helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/
helm install my-release groundhog2k/mariadb

Introduction

This chart uses the original MariaDB image from Docker Hub to deploy a stateful MariaDB instance in a Kubernetes cluster.

It fully supports deployment of the multi-architecture docker image.

Prerequisites

  • Kubernetes 1.12+
  • Helm 3.x
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with the release name my-release:

helm install my-release groundhog2k/mariadb

Uninstalling the Chart

To uninstall/delete the my-release deployment:

helm uninstall my-release

Common parameters

KeyTypeDefaultDescription
fullnameOverridestring""Fully override the deployment name
nameOverridestring""Partially override the deployment name

Deployment parameters

KeyTypeDefaultDescription
image.pullPolicystring"IfNotPresent"Image pull policy
image.registrystring"docker.io"Image registry
image.repositorystring"mariadb"Image name
image.tagstring""Image tag
imagePullSecretslist[]Image pull secrets
extraInitContainerslist[]Extra init containers
extaContainerslist[]Extra containers for usage as sidecars
startupProbeobjectsee values.yamlStartup probe configuration
livenessProbeobjectsee values.yamlLiveness probe configuration
readinessProbeobjectsee values.yamlReadiness probe configuration
customStartupProbeobject{}Custom startup probe (overwrites default startup probe configuration)
customLivenessProbeobject{}Custom liveness probe (overwrites default liveness probe configuration)
customReadinessProbeobject{}Custom readiness probe (overwrites default readiness probe configuration)
resourcesobject{}Resource limits and requests
initResourcesobject{}Resource limits and requests for the default init container
priorityClassNamestring""Deployment priority class name
nodeSelectorobject{}Deployment node selector
customLabelsobject{}Additional labels for Deployment or StatefulSet
customAnnotationsobject{}Additional annotations for Deployment or StatefulSet
podAnnotationsobject{}Additional pod annotations
podLabelsobject{}Additional pod labels
podSecurityContextobjectsee values.yamlPod security context
securityContextobjectsee values.yamlContainer security context
envlist[]Additional container environmment variables
serviceAccount.annotationsobject{}Additional service account annotations
serviceAccount.createboolfalseEnable service account creation
serviceAccount.namestring""Name of the service account
affinityobject{}Affinity for pod assignment
tolerationslist[]Tolerations for pod assignment
topologySpreadConstraintsobject{}Topology spread constraints for pods
podManagementPolicystring"OrderedReady"Pod management policy
updateStrategyTypestring"RollingUpdate"Pod update strategy
revisionHistoryLimitintnilMaximum number of revisions maintained in revision history

Service paramters

KeyTypeDefaultDescription
service.typestring"ClusterIP"Service type
service.portint3306MariaDB service port
service.nodePortintnilThe node port (only relevant for type LoadBalancer or NodePort)
service.clusterIPstringnilThe cluster ip address (only relevant for type LoadBalancer or NodePort)
service.loadBalancerIPstringnilThe load balancer ip address (only relevant for type LoadBalancer)
service.loadBalancerSourceRangeslist[]The list of IP CIDR ranges that are allowed to access the load balancer (only relevent for type LoadBalancer)
service.annotationsobject{}Additional service annotations
service.labelsobject{}Additional service labels

Network policies

Allows to define optional network policies for ingress and egress The policyTypes will be automatically set

KeyTypeDefaultDescription
networkPolicy.ingressobject{}Ingress network policies
networkPolicy.egressobject{}Egress network policies

Storage parameters

KeyTypeDefaultDescription
storage.accessModes[0]string"ReadWriteOnce"Storage access mode
storage.persistentVolumeClaimNamestringnilPVC name when existing storage volume should be used
storage.volumeNamestring"db-volume"Internal volume name and prefix of a created PVC
storage.requestedSizestringnilSize for new PVC, when no existing PVC is used
storage.emptyDirSizeLimitstringnilOptional max size of an emptyDir if no PVC is used
storage.classNamestringnilStorage class name
storage.keepPvcboolfalseKeep a created Persistent volume claim when uninstalling the helm chart (only for option useDeployment: true)
storage.annotationsobject{}Additional storage annotations
storage.labelsobject{}Additional storage labels
extraStoragelist[]A list of additional existing PVC that will be mounted into the container
extraStorage[].namestringnilInternal name of the volume
extraStorage[].pvcNamestringnilName of the existing PVC
extraStorage[].mountPathstringnilMount path where the PVC should be mounted into the container

MariaDB parameters

KeyTypeDefaultDescription
useDeploymentboolfalseUse Kubernetes Deployment instead of StatefulSet
userDatabaseobject{}Optional MariaDB user database
userDatabase.existingSecretstringnilOptional existing secret with database name, user and password
userDatabase.name.secretKeystring""Key of the existingSecret with database name
userDatabase.name.valuestring""Name of the user database (if no existingSecret was specified)
userDatabase.user.secretKeystring""Key of the existingSecret with database user
userDatabase.user.valuestring""User name with full access to user database (if no existingSecret was specified)
userDatabase.password.secretKeystring""Key of the existingSecret with password of created user
userDatabase.password.valuestring""Password of created user (if no existingSecret was specified)
settings.existingSecretstringnilOptional existing secret for the root password
settings.rootPassword.secretKeystringnilKey of existingSecret for the MariaDB root password
settings.rootPassword.valuestringnilMariaDB root password (if no existingSecret was specified)
settings.allowEmptyRootPasswordboolfalseSet true to allow an empty root password
settings.skipTZInfoboolfalseSet true to skip loading timezone data during init
settings.argumentslist[]Additional arguments for mysqld (entrypoint process)
customConfigstringnilAdditional MariaDB custom configuration mounted as /etc/mysql/custom.cnf
extraEnvSecretslist[]A list of existing secrets that will be mounted into the container as environment variables
extraSecretConfigsstringnilAn existing secret with files that will be mounted into the container as custom MariaDB configuration files (*.cnf) in /etc/mysql/conf.d
customScriptsobjectnilOptional custom scripts that can be defined inline and will be mounted as files in /docker-entrypoint-initdb.d
extraScriptsstringnilAn existing configMap with files that will be mounted into the container as script files (*.sql, *.sh) in /docker-entrypoint-initdb.d
extraSecretslist[]A list of additional existing secrets that will be mounted into the container
extraSecrets[].namestringnilName of the existing K8s secret
extraSecrets[].defaultModeint0440Mount default access mode
extraSecrets[].mountPathstringnilMount path where the secret should be mounted into the container (f.e. /mysecretfolder)
extraConfigslist[]A list of additional existing configMaps that will be mounted into the container
extraConfigs[].namestringnilName of the existing K8s configMap
extraConfigs[].defaultModeint0440Mount default access mode
extraConfigs[].mountPathstringnilMount path where the configMap should be mounted into the container (f.e. /myconfigfolder)

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 v4.44.0 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