Coder Social home page Coder Social logo

mariadb-helm's Introduction

MariaDB Official

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.

MariaDB is developed as open source software and as a relational database it provides an SQL interface for accessing data. The latest versions of MariaDB also include GIS and JSON features.

This Helm chart is deprecated

Given the stable deprecation timeline, the Bitnami maintained MariaDB Helm chart is now located at bitnami/charts.

The Bitnami repository is already included in the Hubs and we will continue providing the same cadence of updates, support, etc that we've been keeping here these years. Installation instructions are very similar, just adding the bitnami repo and using it during the installation (bitnami/<chart> instead of stable/<chart>)

$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install my-release bitnami/<chart>           # Helm 3
$ helm install --name my-release bitnami/<chart>    # Helm 2

To update an exisiting stable deployment with a chart hosted in the bitnami repository you can execute

$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm upgrade my-release bitnami/<chart>

Issues and PRs related to the chart itself will be redirected to bitnami/charts GitHub repository. In the same way, we'll be happy to answer questions related to this migration process in this issue created as a common place for discussion.

TL;DR;

$ helm install my-release stable/mariadb

Introduction

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

Bitnami charts can be used with Kubeapps for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the BKPR.

Prerequisites

  • Kubernetes 1.12+
  • Helm 2.11+ or Helm 3.0-beta3+
  • PV provisioner support in the underlying infrastructure

Installing the Chart

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

$ helm install my-release stable/mariadb

The command deploys MariaDB on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

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

Parameters

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

Parameter Description Default
global.imageRegistry Global Docker image registry nil
global.imagePullSecrets Global Docker registry secret names as an array [] (does not add image pull secrets to deployed pods)
global.storageClass Global storage class for dynamic provisioning nil
image.registry MariaDB image registry docker.io
image.repository MariaDB Image name bitnami/mariadb
image.tag MariaDB Image tag {TAG_NAME}
image.pullPolicy MariaDB image pull policy IfNotPresent
image.pullSecrets Specify docker-registry secret names as an array [] (does not add image pull secrets to deployed pods)
image.debug Specify if debug logs should be enabled false
nameOverride String to partially override mariadb.fullname template with a string (will prepend the release name) nil
fullnameOverride String to fully override mariadb.fullname template with a string nil
volumePermissions.enabled Enable init container that changes volume permissions in the data directory (for cases where the default k8s runAsUser and fsUser values do not work) false
volumePermissions.image.registry Init container volume-permissions image registry docker.io
volumePermissions.image.repository Init container volume-permissions image name bitnami/minideb
volumePermissions.image.tag Init container volume-permissions image tag buster
volumePermissions.image.pullPolicy Init container volume-permissions image pull policy Always
volumePermissions.resources Init container resource requests/limit nil
service.type Kubernetes service type ClusterIP
service.clusterIp.master Specific cluster IP for master when service type is cluster IP. Use None for headless service nil
service.clusterIp.slave Specific cluster IP for slave when service type is cluster IP. Use None for headless service nil
service.port MySQL service port 3306
serviceAccount.create Specifies whether a ServiceAccount should be created false
serviceAccount.name The name of the ServiceAccount to create Generated using the mariadb.fullname template
schedulerName Name of the k8s scheduler (other than default) nil
rbac.create Create and use RBAC resources false
securityContext.enabled Enable security context true
securityContext.fsGroup Group ID for the container 1001
securityContext.runAsUser User ID for the container 1001
existingSecret Use existing secret for password details (rootUser.password, db.password, replication.password will be ignored and picked up from this secret). The secret has to contain the keys mariadb-root-password, mariadb-replication-password and mariadb-password. nil
rootUser.password Password for the root user. Ignored if existing secret is provided. random 10 character alphanumeric string
rootUser.forcePassword Force users to specify a password false
rootUser.injectSecretsAsVolume Mount admin user password as a file instead of using an environment variable false
db.name Name for new database to create my_database
db.user Username of new user to create ""
db.password Password for the new user. Ignored if existing secret is provided. random 10 character alphanumeric string if db.user is defined
db.forcePassword Force users to specify a password false
db.injectSecretsAsVolume Mount user password as a file instead of using an environment variable false
replication.enabled MariaDB replication enabled true
replication.user MariaDB replication user replicator
replication.password MariaDB replication user password. Ignored if existing secret is provided. random 10 character alphanumeric string
replication.forcePassword Force users to specify a password false
replication.injectSecretsAsVolume Mount replication user password as a file instead of using an environment variable false
initdbScripts Dictionary of initdb scripts nil
initdbScriptsConfigMap ConfigMap with the initdb scripts (Note: Overrides initdbScripts) nil
master.annotations[].key key for the the annotation list item nil
master.annotations[].value value for the the annotation list item nil
master.extraFlags MariaDB master additional command line flags nil
master.affinity Master affinity (in addition to master.antiAffinity when set) {}
master.antiAffinity Master pod anti-affinity policy soft
master.nodeSelector Master node labels for pod assignment {}
master.tolerations List of node taints to tolerate (master) []
master.updateStrategy Master statefulset update strategy policy RollingUpdate
master.persistence.enabled Enable persistence using PVC true
master.persistence.existingClaim Provide an existing PersistentVolumeClaim nil
master.persistence.subPath Subdirectory of the volume to mount nil
master.persistence.mountPath Path to mount the volume at /bitnami/mariadb
master.persistence.annotations Persistent Volume Claim annotations {}
master.persistence.storageClass Persistent Volume Storage Class ``
master.persistence.accessModes Persistent Volume Access Modes [ReadWriteOnce]
master.persistence.size Persistent Volume Size 8Gi
master.extraInitContainers Additional init containers as a string to be passed to the tpl function (master)
master.extraEnvVars Array containing extra env vars to configure MariaDB master replicas nil
master.config Config file for the MariaDB Master server _default values in the values.yaml file_
master.resources CPU/Memory resource requests/limits for master node {}
master.livenessProbe.enabled Turn on and off liveness probe (master) true
master.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated (master) 120
master.livenessProbe.periodSeconds How often to perform the probe (master) 10
master.livenessProbe.timeoutSeconds When the probe times out (master) 1
master.livenessProbe.successThreshold Minimum consecutive successes for the probe (master) 1
master.livenessProbe.failureThreshold Minimum consecutive failures for the probe (master) 3
master.readinessProbe.enabled Turn on and off readiness probe (master) true
master.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated (master) 30
master.readinessProbe.periodSeconds How often to perform the probe (master) 10
master.readinessProbe.timeoutSeconds When the probe times out (master) 1
master.readinessProbe.successThreshold Minimum consecutive successes for the probe (master) 1
master.readinessProbe.failureThreshold Minimum consecutive failures for the probe (master) 3
master.podDisruptionBudget.enabled If true, create a pod disruption budget for master pods. false
master.podDisruptionBudget.minAvailable Minimum number / percentage of pods that should remain scheduled 1
master.podDisruptionBudget.maxUnavailable Maximum number / percentage of pods that may be made unavailable nil
master.service.annotations Master service annotations {}
slave.replicas Desired number of slave replicas 1
slave.annotations[].key key for the the annotation list item nil
slave.annotations[].value value for the the annotation list item nil
slave.extraFlags MariaDB slave additional command line flags nil
slave.affinity Slave affinity (in addition to slave.antiAffinity when set) {}
slave.antiAffinity Slave pod anti-affinity policy soft
slave.nodeSelector Slave node labels for pod assignment {}
slave.tolerations List of node taints to tolerate for (slave) []
slave.updateStrategy Slave statefulset update strategy policy RollingUpdate
slave.persistence.enabled Enable persistence using a PersistentVolumeClaim true
slave.persistence.annotations Persistent Volume Claim annotations {}
slave.persistence.storageClass Persistent Volume Storage Class ``
slave.persistence.accessModes Persistent Volume Access Modes [ReadWriteOnce]
slave.persistence.size Persistent Volume Size 8Gi
slave.extraInitContainers Additional init containers as a string to be passed to the tpl function (slave) nil
slave.extraEnvVars Array containing extra env vars to configure MariaDB slave replicas nil
slave.config Config file for the MariaDB Slave replicas _default values in the values.yaml file_
slave.resources CPU/Memory resource requests/limits for slave node {}
slave.livenessProbe.enabled Turn on and off liveness probe (slave) true
slave.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated (slave) 120
slave.livenessProbe.periodSeconds How often to perform the probe (slave) 10
slave.livenessProbe.timeoutSeconds When the probe times out (slave) 1
slave.livenessProbe.successThreshold Minimum consecutive successes for the probe (slave) 1
slave.livenessProbe.failureThreshold Minimum consecutive failures for the probe (slave) 3
slave.readinessProbe.enabled Turn on and off readiness probe (slave) true
slave.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated (slave) 45
slave.readinessProbe.periodSeconds How often to perform the probe (slave) 10
slave.readinessProbe.timeoutSeconds When the probe times out (slave) 1
slave.readinessProbe.successThreshold Minimum consecutive successes for the probe (slave) 1
slave.readinessProbe.failureThreshold Minimum consecutive failures for the probe (slave) 3
slave.podDisruptionBudget.enabled If true, create a pod disruption budget for slave pods. false
slave.podDisruptionBudget.minAvailable Minimum number / percentage of pods that should remain scheduled 1
slave.podDisruptionBudget.maxUnavailable Maximum number / percentage of pods that may be made unavailable nil
slave.service.annotations Slave service annotations {}
metrics.enabled Start a side-car prometheus exporter false
metrics.image.registry Exporter image registry docker.io
metrics.image.repository Exporter image name bitnami/mysqld-exporter
metrics.image.tag Exporter image tag {TAG_NAME}
metrics.image.pullPolicy Exporter image pull policy IfNotPresent
metrics.resources Exporter resource requests/limit nil
metrics.extraArgs.master Extra args to be passed to mysqld_exporter []
metrics.extraArgs.slave Extra args to be passed to mysqld_exporter []
metrics.livenessProbe.enabled Turn on and off liveness probe (metrics) true
metrics.livenessProbe.initialDelaySeconds Delay before liveness probe is initiated (metrics) 120
metrics.livenessProbe.periodSeconds How often to perform the probe (metrics) 10
metrics.livenessProbe.timeoutSeconds When the probe times out (metrics) 1
metrics.livenessProbe.successThreshold Minimum consecutive successes for the probe (metrics) 1
metrics.livenessProbe.failureThreshold Minimum consecutive failures for the probe (metrics) 3
metrics.readinessProbe.enabled Turn on and off readiness probe (metrics) true
metrics.readinessProbe.initialDelaySeconds Delay before readiness probe is initiated (metrics) 30
metrics.readinessProbe.periodSeconds How often to perform the probe (metrics) 10
metrics.readinessProbe.timeoutSeconds When the probe times out (metrics) 1
metrics.readinessProbe.successThreshold Minimum consecutive successes for the probe (metrics) 1
metrics.readinessProbe.failureThreshold Minimum consecutive failures for the probe (metrics) 3
metrics.serviceMonitor.enabled if true, creates a Prometheus Operator ServiceMonitor (also requires metrics.enabled to be true) false
metrics.serviceMonitor.namespace Optional namespace which Prometheus is running in nil
metrics.serviceMonitor.interval How frequently to scrape metrics (use by default, falling back to Prometheus' default) nil
metrics.serviceMonitor.selector Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install { prometheus: kube-prometheus }
tests.enabled Provide tests to check if connect and authentication is possible true
tests.resources Resource definition for the test-runner pod nil
tests.testFramework.image.registry Test framework image registry (init container) docker.io
tests.testFramework.image.repository Test framework image name dduportal/bats
tests.testFramework.image.tag Test framework image tag 0.4.0
tests.testFramework.resources Resource definition for the test framework nil

The above parameters map to the env variables defined in bitnami/mariadb. For more information please refer to the bitnami/mariadb image documentation.

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

$ helm install my-release \
  --set rootUser.password=secretpassword,db.user=app_database \
    stable/mariadb

The above command sets the MariaDB root account password to secretpassword. Additionally it creates 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 my-release -f values.yaml stable/mariadb

Tip: You can use the default values.yaml

Configuration and installation details

It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.

Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.

Production configuration

This chart includes a values-production.yaml file where you can find some parameters oriented to production configuration in comparison to the regular values.yaml. You can use this file instead of the default one.

  • Force users to specify a password and mount secrets as volumes instead of using environment variables:
- rootUser.forcePassword: false
- rootUser.injectSecretsAsVolume: false
+ rootUser.forcePassword: true
+ rootUser.injectSecretsAsVolume: true
- db.forcePassword: false
- db.injectSecretsAsVolume: false
+ db.forcePassword: true
+ db.injectSecretsAsVolume: true
- replication.forcePassword: false
- replication.injectSecretsAsVolume: false
+ replication.forcePassword: true
+ replication.injectSecretsAsVolume: true
  • Desired number of slave replicas:
- slave.replicas: 1
+ slave.replicas: 2
  • Start a side-car prometheus exporter:
- metrics.enabled: false
+ metrics.enabled: true

Initialize a fresh instance

The Bitnami MariaDB image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder files/docker-entrypoint-initdb.d so they can be consumed as a ConfigMap.

Alternatively, you can specify custom scripts using the initdbScripts parameter as dict.

In addition to these options, you can also set an external ConfigMap with all the initialization scripts. This is done by setting the initdbScriptsConfigMap parameter. Note that this will override the two previous options.

The allowed extensions are .sh, .sql and .sql.gz.

Extra Init Containers

The feature allows for specifying a template string for a initContainer in the master/slave pod. Usecases include situations when you need some pre-run setup. For example, in IKS (IBM Cloud Kubernetes Service), non-root users do not have write permission on the volume mount path for NFS-powered file storage. So, you could use a initcontainer to chown the mount. See a example below, where we add an initContainer on the master pod that reports to an external resource that the db is going to starting. values.yaml

master:
  extraInitContainers: |
    - name: initcontainer
      image: bitnami/minideb:buster
      command: ["/bin/sh", "-c"]
      args:
        - install_packages curl && curl http://api-service.local/db/starting;

Persistence

The Bitnami MariaDB image stores the MariaDB data and configurations at the /bitnami/mariadb path of the container.

The chart mounts a Persistent Volume volume at this location. The volume is created using dynamic volume provisioning, by default. An existing PersistentVolumeClaim can be defined.

Adjust permissions of persistent volume mountpoint

As the image run as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container can write data into it.

By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions. As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination.

You can enable this initContainer by setting volumePermissions.enabled to true.

Upgrading

It's necessary to set the rootUser.password parameter when upgrading for readiness/liveness probes to work properly. When you install this chart for the first time, some notes will be displayed providing the credentials you must use under the 'Administrator credentials' section. Please note down the password and run the command below to upgrade your chart:

$ helm upgrade my-release stable/mariadb --set rootUser.password=[ROOT_PASSWORD]

| Note: you need to substitute the placeholder [ROOT_PASSWORD] with the value obtained in the installation notes.

To 7.0.0

Helm performs a lookup for the object based on its group (apps), version (v1), and kind (Deployment). Also known as its GroupVersionKind, or GVK. Changing the GVK is considered a compatibility breaker from Kubernetes' point of view, so you cannot "upgrade" those objects to the new GVK in-place. Earlier versions of Helm 3 did not perform the lookup correctly which has since been fixed to match the spec.

In helm/charts#17308 the apiVersion of the statefulset resources was updated to apps/v1 in tune with the api's deprecated, resulting in compatibility breakage.

This major version bump signifies this change.

To 6.0.0

MariaDB version was updated from 10.1 to 10.3, there are no changes in the chart itself. According to the official documentation, upgrading from 10.1 should be painless. However, there are some things that have changed which could affect an upgrade:

To 5.0.0

Backwards compatibility is not guaranteed unless you modify the labels used on the chart's deployments. Use the workaround below to upgrade from versions previous to 5.0.0. The following example assumes that the release name is mariadb:

$ kubectl delete statefulset opencart-mariadb --cascade=false

mariadb-helm's People

Contributors

kaulaskar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.