proxysql

by flachesis

Helm chartv1.7.0App 2.3.0

A proxysql Helm chart for Kubernetes

About this chart

ProxySQL

ProxySQL is a High-performance MySQL proxy with a GPL license.

TL;DR;

$ helm repo add proxysql https://flachesis.github.io/proxysql
$ helm install my-release proxysql/proxysql

Introduction

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

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0-beta3+

Installing the Chart

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

$ helm install my-release proxysql/proxysql

The command deploys ProxySQL on the Kubernetes cluster in the default configuration. The Parameters 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.

Parameters

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

ParameterDescriptionDefault
replicaCountReplica count1
image.repositoryProxySQL Image nameproxysql/proxysql
image.tagProxySQL Image tag2.0.9
image.pullPolicyProxySQL image pull policyIfNotPresent
imagePullSecretsSpecify docker-registry secret names as an array[] (does not add image pull secrets to deployed pods)
service.typeKubernetes service typeClusterIP
service.portProxySQL service portdefault as proxysql.mysql.port
service.annotationsService annotations{}
podAnnotationsPod annotations{}
serviceAccount.createSpecifies whether a ServiceAccount should be createdtrue
serviceAccount.nameThe name of the ServiceAccount to createGenerated using the proxysql.fullname template
nameOverrideString to partially override proxysql.fullname template with a string (will prepend the release name)nil
fullnameOverrideString to fully override proxysql.fullname template with a stringnil
securityContexta container security context{}
podSecurityContextpod security{}
proxysql.configmapProxySQL confgmaps namenil
proxysql.admin.userProxySQL admin user for the management (127.0.0.1:6032)admin
proxysql.admin.passwordProxySQL admin passwordadmin
proxysql.portProxySQL management port6032
proxysql.monitor.enabledEnable Monitor for Backendfalse
proxysql.monitor.userMonitor user namenil
proxysql.monitor.passwordMonitor user passwordnil
proxysql.monitor.writerAsReaderAdd writer to readertrue
`proxysql.monitor.replicationLagIntervalThe interval of checking replication lag10000
`proxysql.monitor.replicationLagTimeoutHow long the Monitor module will wait for the output1500
`proxysql.monitor.slaveLagWhenNullIt's assumed to be the current replica lag when SBM=NULL60
proxysql.cluster.enabledEnable ProxySQL clusterfalse
proxysql.cluster.userProxySQL cluster usercluster
proxysql.cluster.passwordProxySQL cluster passwordcluster
proxysql.cluster.claim.enabledEnable ProxySQL claimtrue
proxysql.cluster.claim.accessModesProxySQL claim accessModes[ "ReadWriteOnce" ]
proxysql.cluster.claim.storageClassNameStorage class namedefault
proxysql.cluster.claim.sizeStorage size1Gi
proxysql.web.userProxySQL web user for the statesadmin
proxysql.web.passwordProxySQL web passwordsadmin
proxysql.mysql.versionMySQL version5.7.34
proxysql.mysql.portMySQL port3306
proxysql.mysql.maxConnectionsThe max num of client conn that the proxy can handle2048
proxysql.mysql.connectionMaxAgeMSThe max age of inactive conn0
proxysql.mysql.queyCacheSizeMBQuery cache size in MB256
proxysql.mysql.waitTimeoutmysql backend session timeout28800000
proxysql.mysql.queryRetriesOnFailurequery retries on failure2
proxysql.mysql.readWriteSplitMySQL Read/Write Splittingtrue
proxysql.mysql.servers.[].isWriterMySQL backend is writabletrue
proxysql.mysql.servers.[].hostnameMySQL backend's hostnamenil
proxysql.mysql.servers.[].portMySQL backend's port3306
proxysql.mysql.servers.[].maxConnectionsThe max num of conn that the backend can handle1000
proxysql.mysql.servers.[].compressionCompress datafalse
proxysql.mysql.servers.[].weightServer weight1000
proxysql.mysql.servers.[].maxReplicationLagServer max replica lag0
proxysql.mysql.users.[].usernameThe user for connecting backendnil
proxysql.mysql.users.[].passwordThe user's passwordnil
proxysql.mysql.users.[].readOnlyDoes the user is read onlyfalse
proxysql.mysql.users.[].maxConnectionsThe max connections that the proxysql can handle10000
proxysql.mysql.slave.enabledEnable the traditional master/slave replicationfalse
proxysql.mysql.slave.checkTypecheck read_only, use innodb_read_only for AWS Auroraread_only
proxysql.mysql.galera.enabledEnable the Percona XtraDB Clusterfalse
proxysql.mysql.galera.maxWritersThe max writers that the proxySQL can use.1
proxysql.mysql.galera.writerAsReaderUse the writer as readertrue
autoscaling.enabledEnable Autoscaling for pods (only supported when proxysql.cluster.enabled is false)false
autoscaling.minReplicas1
autoscaling.maxReplicas100
autoscaling.targetCPUUtilizationPercentage80
autoscaling.targetMemoryUtilizationPercentagenil
resourcesCompute Resource Quota{}
nodeSelectorPod node selector{}
tolerationsTolerations[]
affinityCompute Resource Quota{}

For more information please refer to the proxysql config file and global variables.

Tip: You can use the default values.yaml

Configuration and installation details

ProxySQL persists its configuration in SQLite, however this deployment is stateless i.e. no data is persisted. Since the configuration is managed via kubernetes and admin ProxySQL CLI is not meant for the configuration purposes all you need is to provide a values.yaml input file:

$ helm install my-release proxysql/proxysql -f values.ya

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 v1.7.0 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