ibm-galera-mariadb-dev

by Helm

Helm chartv1.1.0Apache-2.0

Galera Cluster is a multi-master solution for MariaDB which provides an easy-to-use, high-availability solution for MariaDB based databases.

About this chart

MariaDB Galera Cluster

MariaDB is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source. Notable users include Wikipedia, Facebook and Google.

Galera Cluster is a multi-master solution for MariaDB which provides an easy-to-use, high-availability solution for MariaDB based databases.

Introduction

This chart bootstraps a MariaDB Galera Cluster deployment on a Kubernetes cluster using the Helm package manager.

Chart Details

This chart creates:

  • StatefulSet of a multiple MariaDB databases with Galera clustering
  • Service to expose the nodes of the StatefulSet to the Kubernetes cluster
  • Secret to store database credentials

Prerequisites

  • Kubernetes 1.7+ with Beta APIs enabled
  • Tiller 2.7.2 or later
  • The host servers need to support /etc/localtime for the databases to have accurate times within the cluster
  • PersistentVolume Provisioner support in the underlying infrastructure or manually created Persistent Volumes

Resources Required

The chart deploys pods consuming minimum resources as specified in the resources configuration parameter (default: Memory: 256Mi, CPU: 250m)

Installing the Chart

This deploys MariaDB with Galera Cluster on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

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

helm install --name my-release stable/ibm-galera-mariadb-dev

After the command runs, it will print the current status of the release and extra information such as how to access the RabbitMQ admin console with a browser.

Tip: List all releases using helm list

Verifying the Chart

See NOTES.txt associated with this chart for verification instructions

Uninstalling the Chart

To uninstall/delete the my-release deployment:

helm delete --purge my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the MariaDB chart and their default values.

ParameterDescriptionDefault
arch.amd64Preference to run on amd64 architecture2 - No preference
arch.ppc64lePreference to run on ppc64le architecture2 - No preference
image.repositoryDocker image repositoryibmcom/galera-mariadb
image.tagDocker image tag10.2.14
image.pullPolicyImage pull policyIfNotPresent
mariadb.rootPasswordPassword for the root user.random 16 character alphanumeric string
mariadb.userUsername of new user to create.""
mariadb.passwordPassword for the new user.""
mariadb.databaseName for new database to create.""
mariadb.configMapNameName of a ConfigMap containing a my_extra.cnf""
replicas.replicaCountNumber of replicas to deploy3
persistence.enabledUse a PVC to persist datatrue
persistence.useDynamicProvisioningUse dynamic provisioning for all volumestrue
dataPVC.storageClassNameStorage class of dynamic provisioning""
dataPVC.selector.labelRefine the binding process if not using dynamic provisioning with the name of a label to search for""
dataPVC.selector.valueRefine the binding process if not using dynamic provisioning with the value of a label to search for""
dataPVC.sizeSize of data volume2Gi
resources.requests.memoryMemory resource requests256Mi
resources.requests.cpuCPU resource requests250m
resources.limits.memoryMemory resource limits1Gi
resources.limits.cpuCPU resource limits1000m

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

$ helm install --name my-release \
  --set mariadb.rootPassword=secretpassword,mariadb.user=my-user,mariadb.password=my-password,mariadb.database=my-database \
    stable/ibm-galera-mariadb-dev

The above command sets the MariaDB root account password to secretpassword. Additionally it creates a standard database user named my-user, with the password my-password, who has access to a database named my-database.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

helm install --name my-release -f values.yaml stable/ibm-galera-mariadb-dev

Tip: You can use the default values.yaml

Random MariaDB root password

If you don't configure a password for the MariaDB root user, helm will generate a random one for you. You can get the configured password from the created Kubernetes secret:

kubectl get secret <release_name>-ibm-galera-mariadb-dev  -o jsonpath='{.data.mysql-root-password}' | base64 --decode

Custom my.cnf configuration

A Kubernetes ConfigMap can be created and use that supplies MariaDB configuration that would normally go in a my.cnf file. If you wnat to inject configuration, you will need to create a ConfigMap containing data for my_extra.cnf.

For example, create a galera-my-cnf.yaml file with the following content:

apiVersion: v1
kind: ConfigMap
metadata:
  name: galera-my-cnf
data:
  my_extra.cnf: |-
    [mysqld]
    max_allowed_packet = 64M
    sql_mode=STRICT_ALL_TABLES
    innodb_buffer_pool_size=2G

And then create the ConfigMap:

kubectl create -f galera-my-cnf.yaml

Storage

The MariaDB Galera Chart image stores the MariaDB data files at the /var/lib/mysql path of the container.

The chart mounts a Persistent Volume at this location in every pod of the StatefulSet. The volumes may be dynamically provisioned by a PersistentVolume Provisioner or may be manually created ahead of time and then claimed.

Limitations

  • replicas.replicaCount needs to be 3 or more for automatic cluster failovers. Read more about how the number of nodes affects quorum.
  • The chart does not support the s390x architecture

Copyright

© Copyright IBM Corporation 2018. All Rights Reserved.

Deploy ibm-galera-mariadb-dev with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ibm-galera-mariadb-dev 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 chartibm-galera-mariadb-dev is pinned at v1.1.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