MySQL
MySQL MySQL is a fast, reliable, scalable, and easy to use open-source relational database system. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
TL;DR;
$ helm install bitnami/mysql
Introduction
This chart bootstraps a MySQL deployment on a Kubernetes cluster using the Helm package manager.
Prerequisites
- Kubernetes 1.4+ 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 bitnami/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.
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.
Configuration
The following tables lists the configurable parameters of the MySQL chart and their default values.
| Parameter | Description | Default |
|---|---|---|
image.registry |
MySQL image registry | docker.io |
image.repository |
MySQL Image name | bitnami/mysql |
image.tag |
MySQL Image tag | {VERSION} |
image.pullPolicy |
MySQL image pull policy | Always if imageTag is latest, else IfNotPresent |
image.pullSecrets |
Specify image pull secrets | nil (does not add image pull secrets to deployed pods) |
mysqlRootPassword |
Password for the root user. |
nil |
mysqlUser |
Username of new user to create. | nil |
mysqlPassword |
Password for the new user. | nil |
mysqlDatabase |
Name for new database to create. | nil |
persistence.enabled |
Use a PVC to persist data | true |
persistence.storageClass |
Storage class of backing PVC | nil (uses alpha storage class annotation) |
persistence.accessMode |
Use volume as ReadOnly or ReadWrite | ReadWriteOnce |
persistence.size |
Size of data volume | 8Gi |
resources |
CPU/Memory resource requests/limits | Memory: 256Mi, CPU: 250m |
config |
Multi-line string for my.cnf configuration | nil |
The above parameters map to the env variables defined in bitnami/mysql. For more information please refer to the bitnami/mysql image documentation.
Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,
$ helm install --name my-release \
--set mysqlRootPassword=secretpassword,mysqlUser=my-user,mysqlPassword=my-password,mysqlDatabase=my-database \
bitnami/mysql
The above command sets the MySQL 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 bitnami/mysql
Tip
: You can use the default values.yaml
Custom my.cnf configuration
The Bitnami MySQL image allows you to provide a custom my.cnf file for configuring MySQL.
This Chart uses the config value to mount a custom my.cnf using a ConfigMap.
You can configure this by creating a YAML file that defines the config property as a multi-line string in the format of a my.cnf file.
For example:
cat > mysql-values.yaml <<EOF
config: |-
[mysqld]
max_allowed_packet = 64M
sql_mode=STRICT_ALL_TABLES
ft_stopword_file=/etc/mysql/stopwords.txt
ft_min_word_len=3
ft_boolean_syntax=' |-><()~*:""&^'
innodb_buffer_pool_size=2G
EOF
helm install --name my-release -f mysql-values.yaml bitnami/mysql
Persistence
The Bitnami MySQL image stores the MySQL data and configurations at the /bitnami/mysql path of the container.
The chart mounts a Persistent Volume volume at this location. The volume is created using dynamic volume provisioning.