proxysql

by christianhuth

Helm chartv3.2.2App 3.0.12Verified publisher

A proxysql Helm chart for Kubernetes. Offers option to expose web interface through Ingress. Uses ServiceMonitor to collect metrics.

About this chart

proxysql

A proxysql Helm chart for Kubernetes. Offers option to expose web interface through Ingress. Uses ServiceMonitor to collect metrics.

TL;DR;

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/proxysql

Or install it from the OCI registry:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/proxysql

Introduction

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

Prerequisites

  • Kubernetes 1.19+

Installing the Chart

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

helm repo add christianhuth https://charts.christianhuth.de
helm repo update
helm install my-release christianhuth/proxysql

The chart is also published as an OCI artifact which can be installed like this:

helm install my-release oci://ghcr.io/christianhuth/helm-charts/proxysql

These commands deploy proxysql on the Kubernetes cluster in the default configuration. The Values section lists the values that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall the my-release deployment:

helm uninstall my-release

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

Configuration ownership: Helm values vs. runtime admin changes

ProxySQL can be configured two ways: through the config file this chart renders from Helm values (/etc/proxysql.cnf), and at runtime through the admin interface (LOAD ... TO RUNTIME; SAVE ... TO DISK), which persists to the config database (/var/lib/proxysql/proxysql.db).

The proxysql.config.reloadOnRestart value controls which side wins after a restart:

  • true (default): ProxySQL starts with the --reload flag. On every container start the rendered config file is merged over the persisted config database — every key present in the config file is reset to its Helm-values state, silently reverting runtime admin changes to those keys, even with persistence enabled. Use this when Helm values are your single source of truth (e.g. GitOps). Note that ProxySQL's startup message "Ignoring configuration file ... as the config DB has higher precedence" is printed even when --reload has just merged the file, so do not rely on it.
  • false: the config file is only read when no config database exists yet (first boot). Runtime admin changes are durable across restarts — this matches ProxySQL's documented operating model. The trade-off: with persistence enabled, later changes to Helm values are not applied to an existing config database; reconfigure through the admin interface, or delete /var/lib/proxysql/proxysql.db (or the PVC) to re-bootstrap from the config file.

If you manage ProxySQL configuration at runtime through the admin interface, set reloadOnRestart: false — otherwise a full restart of all replicas (node pool upgrade, StatefulSet recreation, scale-from-zero) reverts your runtime configuration. With multiple clustered replicas this revert is masked by peer-sync during rolling restarts and only surfaces when all pods boot fresh simultaneously.

Values

KeyTypeDefaultDescription
affinityobject{}Affinity settings for pod assignment
autoscaling.enabledboolfalse
autoscaling.maxReplicasint100
autoscaling.minReplicasint1
autoscaling.targetCPUUtilizationPercentageint80
deploymentStrategyobject{}Update strategy for the deployment, used if proxysql.cluster.enabled is false
fullnameOverridestring""String to fully override "proxysql.fullname"
image.pullPolicystring"Always"image pull policy
image.registrystring"docker.io"image registory
image.repositorystring"proxysql/proxysql"image repository
image.tagstring"3.0.12"Overrides the image tag
imagePullSecretslist[]If defined, uses a Secret to pull an image from a private Docker registry or repository.
ingress.annotations."nginx.ingress.kubernetes.io/backend-protocol"string"HTTPS"
ingress.classNamestring""
ingress.enabledboolfalse
ingress.hosts[0].hoststring"chart-example.local"
ingress.hosts[0].paths[0].pathstring"/"
ingress.hosts[0].paths[0].pathTypestring"ImplementationSpecific"
ingress.tlslist[]
metrics.enabledboolfalse
metrics.serviceMonitor.additionalLabelsobject{}
metrics.serviceMonitor.enabledboolfalse
nameOverridestring""Provide a name in place of proxysql
nodeSelectorobject{}Node labels for pod assignment
podAnnotationsobject{}Annotations to be added to pods
podSecurityContextobject{"fsGroup":999,"runAsGroup":999,"runAsNonRoot":true,"runAsUser":999}pod-level security context
proxysql.admin.passwordstring"admin"
proxysql.admin.userstring"admin"
proxysql.cluster.claim.accessModes[0]string"ReadWriteOnce"
proxysql.cluster.claim.enabledbooltrue
proxysql.cluster.claim.sizestring"1Gi"
proxysql.cluster.claim.storageClassNamestring"default"
proxysql.cluster.enabledboolfalse
proxysql.cluster.passwordstring"cluster"
proxysql.cluster.userstring"cluster"
proxysql.config.existingSecretstring""Use an existing Secret containing the proxysql.cnf config. The secret has to contain the key proxysql.cnf. When it's set the chart will not generate a Secret.
proxysql.config.reloadOnRestartbooltrueStart ProxySQL with the --reload flag. When true, the rendered proxysql.cnf is merged into the persisted config DB on every container start, overwriting runtime admin changes (LOAD ... TO RUNTIME; SAVE ... TO DISK) for every key present in the config file. When false, the config file is only read when no config DB exists yet (first boot), making runtime admin changes durable across restarts, but Helm values changes to the config then no longer apply over an existing config DB.
proxysql.monitor.enabledboolfalse
proxysql.monitor.replicationLagIntervalint10000
proxysql.monitor.replicationLagTimeoutint1500
proxysql.monitor.slaveLagWhenNullint60
proxysql.monitor.writerAsReaderbooltrue
proxysql.mysql.autocommitFalseIsTransactionboolfalse
proxysql.mysql.connectionMaxAgeMSint0
proxysql.mysql.galera.enabledboolfalse
proxysql.mysql.galera.maxWritersint1
proxysql.mysql.galera.writerAsReaderbooltrue
proxysql.mysql.maxConnectionsint2048
proxysql.mysql.portint3306
proxysql.mysql.queryRetriesOnFailureint2
proxysql.mysql.queyCacheSizeMBint256
proxysql.mysql.readWriteSplitbooltrue
proxysql.mysql.serverslist[]
proxysql.mysql.slave.checkTypestring"read_only"
proxysql.mysql.slave.enabledboolfalse
proxysql.mysql.userslist[]
proxysql.mysql.versionstring"5.7.34"
proxysql.mysql.waitTimeoutint28800000
proxysql.portint6032
proxysql.web.enabledbooltrue
proxysql.web.passwordstring"sadmin"
proxysql.web.portint443
proxysql.web.userstring"sadmin"
replicaCountint1Number of replicas
resourcesobject{}Resource limits and requests for the headwind pods.
revisionHistoryLimitint10The number of old ReplicaSets to retain
route.main.additionalRuleslist[]Additional custom rules that can be added to the route
route.main.annotationsobject{}Add annotations to the route
route.main.apiVersionstring"gateway.networking.k8s.io/v1"Set the route apiVersion, e.g. gateway.networking.k8s.io/v1 or gateway.networking.k8s.io/v1alpha2
route.main.enabledboolfalseEnables or disables the route
route.main.filterslist[]Filters define the filters that are applied to requests that match this rule.
route.main.hostnameslist[]Hostnames to be matched
route.main.httpsRedirectboolfalseadds a filter for redirecting to https (HTTP 301 Moved Permanently). To redirect HTTP traffic to HTTPS, you need to have a Gateway with both HTTP and HTTPS listeners. Matches and filters do not take effect if enabled. Ref. https://gateway-api.sigs.k8s.io/guides/http-redirect-rewrite/
route.main.kindstring"HTTPRoute"Set the route kind Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute
route.main.labelsobject{}Add labels to the route
route.main.matcheslistsee values.yamldefine conditions used for matching the rule against incoming HTTP requests.
route.main.parentRefslist[]Parent references (Gateway)
route.main.timeoutsobject{}defines the timeouts that can be configured for an HTTP request
securityContextobject{}container-level security context
service.typestring"ClusterIP"Kubernetes service type
serviceAccount.annotationsobject{}Annotations to add to the service account
serviceAccount.createbooltrueSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template
tolerationslist[]Toleration labels for pod assignment
updateStrategyobject{}Update strategy for the StatefulSet, used if proxysql.cluster.enabled is true

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

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 christianhuth/proxysql

Upgrading the Chart

To 3.0.0

This major updates the way the configuration of ProxySQL is managed. The configuration is now stored in a Kubernetes Secret and mounted as a file into the container. This increases security, but comes with the cost of having to manage the configuration file outside of the chart, when using GitOps. The old way of managing the configuration via chart values is still supported.

Deploy proxysql with OpenTenant

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