MariaDB
MariaDB is a fast, reliable, scalable, and easy to use open-source relational database system. MariaDB Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
Based on the Bitnami MariaDB image for docker, this chart bootstraps a MariaDB deployment on a Kubernetes cluster using Helm.
TL;DR;
$ helm fetch bitnami/mariadb
$ helm generate mariadb
$ helm install mariadb
The above commands will deploy the MariaDB chart to the default kubernetes namespace.
Persistence
For persistence of the MariaDB data, mount a storage volume at the /bitnami/mariadb/data path of the MariaDB pod.
By default the MariaDB chart mounts an emptyDir volume.
From the emptyDir documentation: "An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node... When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."
To persist your MariaDB data across Pod shutdown and startup we need to mount a persistent storage volume at /bitnami/mariadb/data. For the purpose of demonstration we'll use a gcePersistentDisk.
Create a GCE PD using:
$ gcloud compute disks create --size=500GB --zone=us-central1-a mariadb-data-disk
Note: You will be charged additionally for this volume.
Deploying the chart
Step 1: Fetch the bitnami/mariadb chart to your workspace
$ helm fetch bitnami/mariadb
The MariaDB chart will be copied into your workspace, located at ~/.helm/workspace/charts/mariadb/
Step 2: Edit the default MariaDB configuration
$ helm edit mariadb
The default value of the MariaDB root password is bitnami. Edit the value of mariadbPassword in mariadb/tpl/values.toml to change it to your choosing.
Tip: If you have issues running the above command, add
se autochdirto your~/.vimrcprofile or simply edit~/.helm/workspace/charts/mariadb/tpl/values.tomlin your favourite editor.
If you setup a GCE PD, you will need to update the mariadb/tpl/mariadb-controller.yaml as well.
Replace:
volumes:
- name: data
emptyDir: {}
with
volumes:
- name: data
gcePersistentDisk:
pdName: mariadb-data-disk
fsType: ext4
Step 3: Generate the chart
$ helm generate mariadb
The above command will generate the MariaDB chart with your changes from the last step.
Step 4: Deploy MariaDB
$ helm install mariadb
In the above command, Helm will deploy the MariaDB chart in the cluster in the default namespace.
The deployment status of the MariaDB pods can be checked with kubectl using:
$ kubectl get pods -l provider=mariadb
NAME READY STATUS RESTARTS AGE
mariadb-3fu51 1/1 Running 0 1m
Your MariaDB deployment is now ready to be used.
Cleanup
To delete the MariaDB deployment completely:
- Uninstall the MariaDB Chart:
$ helm uninstall -n default mariadb
- Delete the peristent disk:
$ gcloud compute disks delete mariadb-data-disk