mysql

by asdf2014

Helm chartv1.6.4App 5.7.30Verified publisher

Fast, reliable, scalable, and easy to use open-source relational database system.

About this chart

MySQL

MySQL is one of the most popular database servers in the world. Notable users include Wikipedia, Facebook and Google.

Introduction

This chart bootstraps a single node MySQL deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.10+ with Beta APIs enabled
  • PV provisioner support in the underlying infrastructure

Installing the Chart

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

$ helm install --name my-release stable/mysql

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

By default a random password will be generated for the root user. If you'd like to set your own password change the mysqlRootPassword in the values.yaml.

You can retrieve your root password by running the following command. Make sure to replace [YOUR_RELEASE_NAME]:

printf $(printf '\%o' `kubectl get secret [YOUR_RELEASE_NAME]-mysql -o jsonpath="{.data.mysql-root-password[*]}"`)

Tip: List all releases using helm list

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 completely.

Configuration

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

ParameterDescriptionDefault
argsAdditional arguments to pass to the MySQL container.[]
initContainer.resourcesinitContainer resource requests/limitsMemory: 10Mi, CPU: 10m
imagemysql image repository.mysql
imageTagmysql image tag.5.7.14
busybox.imagebusybox image repository.busybox
busybox.tagbusybox image tag.1.29.3
testFramework.enabledtest-framework switch.true
testFramework.imagetest-framework image repository.dduportal/bats
testFramework.tagtest-framework image tag.0.4.0
imagePullPolicyImage pull policyIfNotPresent
existingSecretUse Existing secret for Password detailsnil
extraVolumesAdditional volumes as a string to be passed to the tpl function
extraVolumeMountsAdditional volumeMounts as a string to be passed to the tpl function
extraInitContainersAdditional init containers as a string to be passed to the tpl function
mysqlRootPasswordPassword for the root user. Ignored if existing secret is providedRandom 10 characters
mysqlUserUsername of new user to create.nil
mysqlPasswordPassword for the new user. Ignored if existing secret is providedRandom 10 characters
mysqlDatabaseName for new database to create.nil
livenessProbe.initialDelaySecondsDelay before liveness probe is initiated30
livenessProbe.periodSecondsHow often to perform the probe10
livenessProbe.timeoutSecondsWhen the probe times out5
livenessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed.1
livenessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.3
readinessProbe.initialDelaySecondsDelay before readiness probe is initiated5
readinessProbe.periodSecondsHow often to perform the probe10
readinessProbe.timeoutSecondsWhen the probe times out1
readinessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed.1
readinessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.3
schedulerNameName of the k8s scheduler (other than default)nil
persistence.enabledCreate a volume to store datatrue
persistence.sizeSize of persistent volume claim8Gi RW
persistence.storageClassType of persistent volume claimnil
persistence.accessModeReadWriteOnce or ReadOnlyReadWriteOnce
persistence.existingClaimName of existing persistent volumenil
persistence.subPathSubdirectory of the volume to mountnil
persistence.annotationsPersistent Volume annotations{}
nodeSelectorNode labels for pod assignment{}
affinityAffinity rules for pod assignment{}
tolerationsPod taint tolerations for deployment{}
metrics.enabledStart a side-car prometheus exporterfalse
metrics.imageExporter imageprom/mysqld-exporter
metrics.imageTagExporter imagev0.10.0
metrics.imagePullPolicyExporter image pull policyIfNotPresent
metrics.resourcesExporter resource requests/limitnil
metrics.livenessProbe.initialDelaySecondsDelay before metrics liveness probe is initiated15
metrics.livenessProbe.timeoutSecondsWhen the probe times out5
metrics.readinessProbe.initialDelaySecondsDelay before metrics readiness probe is initiated5
metrics.readinessProbe.timeoutSecondsWhen the probe times out1
metrics.flagsAdditional flags for the mysql exporter to use[]
metrics.serviceMonitor.enabledSet this to true to create ServiceMonitor for Prometheus operatorfalse
metrics.serviceMonitor.additionalLabelsAdditional labels that can be used so ServiceMonitor will be discovered by Prometheus{}
resourcesCPU/Memory resource requests/limitsMemory: 256Mi, CPU: 100m
configurationFilesList of mysql configuration filesnil
configurationFilesPathPath of mysql configuration files/etc/mysql/conf.d/
securityContext.enabledEnable security context (mysql pod)false
securityContext.fsGroupGroup ID for the container (mysql pod)999
securityContext.runAsUserUser ID for the container (mysql pod)999
service.annotationsKubernetes annotations for mysql{}
service.typeKubernetes service typeClusterIP
service.loadBalancerIPLoadBalancer service IP""
serviceAccount.createSpecifies whether a ServiceAccount should be create

Deploy mysql with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mysql 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 chartmysql is pinned at v1.6.4 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