mysql
by HelmForge
MySQL for Kubernetes with explicit standalone and replication modes
About this chart
MySQL
MySQL for Kubernetes with explicit standalone and replication modes, documented bootstrap behavior, optional init scripts,
optional metrics, TLS hardening, External Secrets Operator integration, and production-oriented controls.
Install
HTTPS repository
helm repo add helmforge https://repo.helmforge.dev
helm repo update
helm install mysql helmforge/mysql -f values.yaml
OCI registry
helm install mysql oci://ghcr.io/helmforgedev/helm/mysql -f values.yaml
Supported architectures
| Architecture | When to use | Document |
|---|---|---|
standalone | development, simpler production environments, or workloads where one writable MySQL instance is acceptable | docs/standalone.md |
replication | one writable source plus asynchronous read replicas for read traffic and horizontal read scaling | docs/replication.md |
What this chart covers
- explicit architecture selection through
architecture - MySQL on the official
mysqlimage - generated or externally-managed passwords through
existingSecret - application database and application user bootstrap on first initialization
- optional extra init scripts
- fixed-source asynchronous replication for read replicas
- role-aware readiness checks for source and replicas in replication mode
- optional metrics through
mysqld-exporter - optional
ServiceMonitor - built-in S3 backup CronJob using
mysqldump --all-databases - dedicated metrics Services separated from client traffic
- topology-specific Services for client traffic, source traffic, and read replicas
- dual-stack Service options through
service.ipFamilyPolicyandservice.ipFamilies - External Secrets Operator v1 integration for auth, TLS, and backup Secrets
- optional NetworkPolicy egress rules
- optional TLS private-key permission normalization before MySQL startup
- ServiceAccount token automount control
- optional
extraManifestsfor small companion resources and self-contained CI fixtures
How to choose the architecture
- use
standalonewhen operational simplicity matters more than read scaling - use
replicationwhen you need separate write and read endpoints, but you are not asking the chart to solve automatic failover
Recommended reading before installation:
- Standalone
- Replication
- Replication Operations
- Backup and Restore
- Secret Rotation
- Configuration Profiles
- Production Hardening
Upgrade to MySQL 26.7.0
MySQL 26.7.0 is the first calendar-versioned Innovation release after the 9.7 LTS line. Both tracks are production-grade, but Innovation releases require a faster upgrade cadence. Back up and restore-test all databases, review removed or deprecated settings, and validate application/connector compatibility before upgrading existing PVCs. The backup client image is kept aligned with the server image.
Official product references
- MySQL replication: https://dev.mysql.com/doc/refman/8.4/en/replication.html
- MySQL encrypted connections: https://dev.mysql.com/doc/refman/8.4/en/using-encrypted-connections.html
- MySQL group replication: https://dev.mysql.com/doc/refman/8.4/en/group-replication.html
- MySQL official image: https://hub.docker.com/_/mysql
Operational direction
- for production needing automatic failover, use an operator or another HA-specific solution instead of stretching this chart beyond its scope
replicationin this chart means one fixed source with asynchronous read replicas- built-in logical backup to S3 is available for standalone and replication topologies
Read traffic model
In replication mode, the chart exposes separate Services for different traffic patterns:
- the base client Service for general in-cluster access
- a dedicated source Service for write traffic
- a dedicated replicas Service for read-only traffic
The replicas Service is the endpoint to use for horizontal read scaling when an application or service can work against asynchronous read-only replicas.
Important limits:
- Kubernetes Service balancing distributes connections across available replicas, but it is not a MySQL-aware query router
- replica reads may lag behind the source because replication is asynchronous
- workloads that require immediate read-after-write consistency should stay on the source endpoint
Quick start
Minimal standalone example:
architecture: standalone
auth:
existingSecret: mysql-auth
standalone:
persistence:
enabled: true
size: 20Gi
Replication example:
architecture: replication
auth:
existingSecret: mysql-auth
replication:
source:
persistence:
enabled: true
size: 50Gi
readReplicas:
replicaCount: 2
persistence:
enabled: true
size: 50Gi
metrics:
enabled: true
serviceMonitor:
enabled: true
Best practices
Security
- prefer
auth.existingSecretin production - use
externalSecrets.auth.enabled=truewhen credentials are sourced from an external secret store - keep client access internal unless there is a strong reason to expose MySQL outside the cluster network
- enable
tls.enabled=truewith an externally-managed certificate secret when clients must use encrypted TCP connections - enable
tls.volumePermissions.enabled=truewhen projected TLS Secret modes or ownership are not compatible with the non-root MySQL process - use
tls.requireSecureTransport=trueonly when your clients and replication flows are ready to use TLS - use
networkPolicy.enabled=trueor external platform controls when possible - use
networkPolicy.egress.enabled=truewhen the CNI enforces egress and explicitly allow DNS, same-namespace MySQL traffic, and any required HTTPS destinations - keep
serviceAccount.automountServiceAccountToken=falseunless an added sidecar or extension needs Kubernetes API access - if metrics are scraped through Prometheus, pair
networkPolicy.enabled=truewithnetworkPolicy.metrics.enabled=true - rotate passwords through secret management workflows instead of editing values inline
Replication and availability
- treat
replicationas read scaling and operational recovery help, not full HA - place source and replicas across different nodes or zones when the cluster supports it
- use
pdb.enabled=truewhen running multiple replicas and planning maintenance windows - review the default replication PDB and placement behavior before overriding them globally
- consider
replication.readReplicas.probes.requireRunningReplication=truefor environments where replica readiness should confirm replication threads are healthy - keep
startupProbeconservative for MySQL, especially on larger volumes and replica catch-up paths
Initialization
- use
initdb.scriptsfor deterministic first-boot SQL or shell customization - use
initdb.existingConfigMapwhen scripts are already managed elsewhere - remember that
docker-entrypoint-initdb.druns only during first initialization of a fresh data directory
Observability
- enable
metrics.enabled=truein monitored environments - enable
metrics.serviceMonitor.enabled=truewhen Prometheus Operator is available - metrics are exposed through dedicated metrics Services, not through the client database Services
- monitor connection count, replica lag, disk growth, and binary log retention
Configuration UX
- use
config.presetfor a small set of opinionated MySQL defaults - use workload-oriented presets such as
oltp,read-heavy, oranalyticswhen the generic size presets are too vague - keep
config.myCnffor raw overrides when the preset is not enough - keep
auth.database,auth.username, andauth.replicationUsernameas plain values;existingSecretis intentionally limited to sensitive runtime data
Production notes
- use
auth.existingSecretinstead of inline passwords - alternatively use
externalSecrets.auth.enabled=truewithexternal-secrets.io/v1and a preconfiguredSecretStoreorClusterSecretStore - use
tls.existingSecretfor server certificates instead of trying to inline PEM material in values - use
externalSecrets.tls.enabled=truewhen the TLS Secret should be reconciled by External Secrets Operator - use
externalSecrets.backup.enabled=truefor S3 credentials when the backup Secret should be reconciled by External Secrets Operator - keep persistence enabled for every stateful topology
- set both
whenDeletedandwhenScaledtoRetainunderstandalone.persistence.retentionPolicy,replication.source.persistence.retentionPolicy, orreplication.readReplicas.persistence.retentionPolicywhen uninstall or scale-down must keep the PVCs. Empty fields use the cluster default. - define node placement rules for
replication, especially when the cluster spans multiple nodes or zones - use the
clientorsourceService only for writes - use the
replicasService only for read traffic - use the
replicasService when you need horizontal scale for read-only workloads - when enabling TLS, plan certificate rotation as a rollout event because mounted secrets are not hot-reloaded by mysqld
- built-in backup dumps all MySQL databases from the writable source endpoint and uploads the compressed archive to S3-compatible storage
- treat restore validation, retention policy, and failover as operational workflows that still require explicit runbooks
- review the architecture guides before promoting
replicationto production - start from examples/production.yaml for a complete production-oriented values file
Kubernetes 1.26 disables the StatefulSetAutoDeletePVC feature gate by default. On Kubernetes 1.26, enable the gate
on both the API server and controller manager before relying on a Delete policy; otherwise the API server can omit
the StatefulSet retention field. Kubernetes 1.27 and later enable the feature by default.
Operational documents:
- Replication Operations
- Backup and Restore
- Secret Rotation
- Configuration Profiles
- Production Hardening
Main values
| Parameter | Description | Default |
|---|---|---|
architecture | standalone or replication | standalone |
image.repository | MySQL image repository | docker.io/library/mysql |
image.tag | MySQL image tag | 26.10.0 |
auth.database | App database created at bootstrap | app |
auth.username | App user created at bootstrap | app |
auth.existingSecret | Existing secret for passwords | "" |
auth.replicationUsername | Replication username | replicator |
config.preset | Optional MySQL config preset | none |
standalone.resourcesPreset | Standalone resource preset | none |
replication.source.resourcesPreset | Source resource preset | none |
replication.readReplicas.resourcesPreset | Replica resource preset | none |
metrics.resourcesPreset | Exporter resource preset | none |
initdb.existingConfigMap | External ConfigMap for extra init scripts | "" |
networkPolicy.enabled | Enable NetworkPolicy | false |
networkPolicy.metrics.enabled | Allow metrics scraping through NetworkPolicy | false |
networkPolicy.egress.enabled | Add egress policy rules | false |
networkPolicy.egress.allowDNS | Allow DNS egress | true |
networkPolicy.egress.allowSameNamespaceMySQL | Allow same-namespace MySQL egress | true |
networkPolicy.egress.allowHTTPS | Allow TCP/443 egress | false |
tls.enabled | Enable server TLS from an existing secret | false |
tls.existingSecret | Existing secret with CA, certificate, and key | "" |
tls.requireSecureTransport | Require TLS for TCP client connections | false |
tls.volumePermissions.enabled | Normalize TLS Secret file ownership and modes before startup | false |
tls.client.enabled | Use TLS for chart-managed TCP clients | false |
tls.client.sslMode | MySQL CLI SSL mode for internal chart-managed clients | REQUIRED |
serviceAccount.create | Create a ServiceAccount | false |
serviceAccount.automountServiceAccountToken | Mount Kubernetes API token into workload pods | false |
externalSecrets.enabled | Render ExternalSecret resources | false |
externalSecrets.apiVersion | ExternalSecret API version | external-secrets.io/v1 |
externalSecrets.auth.enabled | Manage the auth Secret through External Secrets Operator | false |
externalSecrets.tls.enabled | Manage the TLS Secret through External Secrets Operator | false |
externalSecrets.backup.enabled | Manage the backup Secret through External Secrets Operator | false |
backup.enabled | Enable built-in S3 backup CronJob | false |
backup.schedule | Backup schedule | "0 3 * * *" |
backup.serviceAccount.create | Create a dedicated ServiceAccount for Pod Identity / IRSA backups | true |
backup.serviceAccount.name | Existing dedicated ServiceAccount for Pod Identity / IRSA backups | "" |
backup.serviceAccount.annotations | Annotations for the Pod Identity / IRSA ServiceAccount | {} |
backup.serviceAccount.automountServiceAccountToken | Mount the Kubernetes API token into backup pods | false |
backup.s3.endpoint | S3-compatible endpoint URL | "" |
backup.s3.bucket | Target bucket name | "" |
backup.s3.region | AWS region used by Pod Identity or IRSA backups | "" |
backup.s3.credentialsFromPodIdentity | Use the backup pod IAM identity instead of static S3 credentials | false |
backup.database.mysqldumpArgs | Extra mysqldump flags used before --all-databases | `"--single-tr |
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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmysql is pinned at v2.4.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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