Skip to main content
helm chart · mysql

MySQL

Helm chart for deploying mysql datastore

Latest version
v0.0.18
Chart type
Data source
Requires
Helm 3+

Install

Add the zop.dev chart repository, then install mysql into your cluster.

helm repo add zopdev https://helm.zop.dev
helm repo update
helm install my-mysql zopdev/mysql --version v0.0.18

The MySQL Helm chart provides an easy way to deploy and manage MySQL instances in your Kubernetes environment. This chart includes configurations for persistence, resource management, and scalability to suit various use cases.

Prerequisites

  • Kubernetes 1.19+
  • Helm 3+

Add Helm Repository

Before installing the MySQL chart, add the repository to your Helm installation and update the repository index:

Terminal window
helm repo add zopdev https://helm.zop.dev
helm repo update

See Helm Repository Documentation for more details.


Install Helm Chart

To install the MySQL Helm chart, run the following command:

Terminal window
helm install [RELEASE_NAME] zopdev/mysql

Replace [RELEASE_NAME] with your desired release name.

For example:

Terminal window
helm install my-mysql zopdev/mysql

You can customize the installation by providing a custom values.yaml file or overriding values via the command line.

See Helm Install Documentation for further details.


Uninstall Helm Chart

To uninstall the MySQL Helm chart and remove all associated Kubernetes resources, run:

Terminal window
helm uninstall [RELEASE_NAME]

For example:

Terminal window
helm uninstall my-mysql

See Helm Uninstall Documentation for more information.


Configuration

The following table describes the configurable parameters of the MySQL Helm chart and their default values:

InputTypeDescriptionDefault
mysqlRootPasswordstringRoot password for the MySQL instance. Leave unset for default random generation.None
updateStrategy.typestringUpdate strategy for the deployment. Options: RollingUpdate or Recreate.RollingUpdate
diskSizestringSize of the persistent volume claim (PVC) for storing MySQL data."10Gi"
imagestringDocker image and tag for the MySQL container.mysql:8.0
resources.requests.cpustringMinimum CPU resources required by the MySQL container."500m"
resources.requests.memorystringMinimum memory resources required by the MySQL container."256M"
resources.limits.cpustringMaximum CPU resources the MySQL container can use."1500m"
resources.limits.memorystringMaximum memory resources the MySQL container can use."1Gi"
customMyCnfstringCustom MySQL configuration to be layered on top of the default config. Provided as a full INI file.""

You can override these values in your values.yaml file or pass them as flags when installing the chart.

Example values.yaml File

Terminal window
diskSize: "10Gi"
# Resource configuration
resources:
requests:
cpu: "500m"
memory: "256M"
limits:
cpu: "1500m"
memory: "1024M"
version: "8.0"
customMyCnf: ""

To use this configuration, save it in a values.yaml file and pass it to the Helm install command:

Terminal window
helm install my-mysql zopdev/mysql -f values.yaml

Example: Providing Custom MySQL Configuration

To override or add to the default MySQL configuration, provide your own my.cnf content using the customMyCnf value. This will be mounted as /etc/mysql/conf.d/custom.cnf in the container and layered on top of the default config.

Example values.yaml:

Terminal window
customMyCnf: |
[mysqld]
max_connections = 200
sql_mode = STRICT_ALL_TABLES

This allows you to specify any MySQL configuration options you need, without losing the chart’s defaults.


Features

  • Persistence: The chart supports persistent volume claims to store MySQL data across pod restarts.
  • Customizable Resources: Define resource requests and limits to optimize performance and manage costs.
  • Scalable: Use the updateStrategy configuration to handle updates with zero downtime.
  • Pre-configured Settings: Defaults are optimized for a variety of workloads.

Advanced Usage

Custom Secrets for Root Password

You can provide a pre-existing Kubernetes secret for the MySQL root password. To enable this, modify the values.yaml file with the secret name:

Terminal window
mysqlRootPassword:
secretName: my-mysql-secret

Ensure the secret is created before deploying the chart:

Terminal window
kubectl create secret generic my-mysql-secret --from-literal=mysql-root-password=my-secure-password

Pod Scheduling

nodeSelector, tolerations and affinity are passed straight through to the pod spec. All three are empty by default and render nothing, so leaving them unset changes nothing for an existing release.

Together they place the workload on a dedicated node pool — the nodeSelector picks the pool, the toleration gets past its taint:

Terminal window
nodeSelector:
workload: stateful
tolerations:
- key: workload
operator: Equal
value: stateful
effect: NoSchedule

affinity takes a full Affinity object and is rendered verbatim.


Contributing

We welcome contributions to improve this Helm chart. Please refer to the CONTRIBUTING.md file for guidelines.


Code of Conduct

To ensure a respectful and collaborative community, please adhere to our Code of Conduct.


License

This project is licensed under the LICENSE. Please review it for terms of use.


Connection Config

  • DB_DIALECT : Specifies the database dialect .In this context always set “mysql” .
  • DB_USER: Username used to connect to mysql database.
  • DB_PORT : The port number used to connect to the MySQL server.Defaults at 3306 .
  • DB_NAME : The name of the specific database to connect to.
  • DB_HOST : The hostname or service name of the MySQL server.
  • DB_PASSWORD : The password for DB_USER stored securely by Kubernetes secrets.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

472 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

472 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·