proxysql
by flachesis
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.
| Parameter | Description | Default |
|---|---|---|
replicaCount | Replica count | 1 |
image.repository | ProxySQL Image name | proxysql/proxysql |
image.tag | ProxySQL Image tag | 2.0.9 |
image.pullPolicy | ProxySQL image pull policy | IfNotPresent |
imagePullSecrets | Specify docker-registry secret names as an array | [] (does not add image pull secrets to deployed pods) |
service.type | Kubernetes service type | ClusterIP |
service.port | ProxySQL service port | default as proxysql.mysql.port |
service.annotations | Service annotations | {} |
podAnnotations | Pod annotations | {} |
serviceAccount.create | Specifies whether a ServiceAccount should be created | true |
serviceAccount.name | The name of the ServiceAccount to create | Generated using the proxysql.fullname template |
nameOverride | String to partially override proxysql.fullname template with a string (will prepend the release name) | nil |
fullnameOverride | String to fully override proxysql.fullname template with a string | nil |
securityContext | a container security context | {} |
podSecurityContext | pod security | {} |
proxysql.configmap | ProxySQL confgmaps name | nil |
proxysql.admin.user | ProxySQL admin user for the management (127.0.0.1:6032) | admin |
proxysql.admin.password | ProxySQL admin password | admin |
proxysql.port | ProxySQL management port | 6032 |
proxysql.monitor.enabled | Enable Monitor for Backend | false |
proxysql.monitor.user | Monitor user name | nil |
proxysql.monitor.password | Monitor user password | nil |
proxysql.monitor.writerAsReader | Add writer to reader | true |
| `proxysql.monitor.replicationLagInterval | The interval of checking replication lag | 10000 |
| `proxysql.monitor.replicationLagTimeout | How long the Monitor module will wait for the output | 1500 |
| `proxysql.monitor.slaveLagWhenNull | It's assumed to be the current replica lag when SBM=NULL | 60 |
proxysql.cluster.enabled | Enable ProxySQL cluster | false |
proxysql.cluster.user | ProxySQL cluster user | cluster |
proxysql.cluster.password | ProxySQL cluster password | cluster |
proxysql.cluster.claim.enabled | Enable ProxySQL claim | true |
proxysql.cluster.claim.accessModes | ProxySQL claim accessModes | [ "ReadWriteOnce" ] |
proxysql.cluster.claim.storageClassName | Storage class name | default |
proxysql.cluster.claim.size | Storage size | 1Gi |
proxysql.web.user | ProxySQL web user for the state | sadmin |
proxysql.web.password | ProxySQL web password | sadmin |
proxysql.mysql.version | MySQL version | 5.7.34 |
proxysql.mysql.port | MySQL port | 3306 |
proxysql.mysql.maxConnections | The max num of client conn that the proxy can handle | 2048 |
proxysql.mysql.connectionMaxAgeMS | The max age of inactive conn | 0 |
proxysql.mysql.queyCacheSizeMB | Query cache size in MB | 256 |
proxysql.mysql.waitTimeout | mysql backend session timeout | 28800000 |
proxysql.mysql.queryRetriesOnFailure | query retries on failure | 2 |
proxysql.mysql.readWriteSplit | MySQL Read/Write Splitting | true |
proxysql.mysql.servers.[].isWriter | MySQL backend is writable | true |
proxysql.mysql.servers.[].hostname | MySQL backend's hostname | nil |
proxysql.mysql.servers.[].port | MySQL backend's port | 3306 |
proxysql.mysql.servers.[].maxConnections | The max num of conn that the backend can handle | 1000 |
proxysql.mysql.servers.[].compression | Compress data | false |
proxysql.mysql.servers.[].weight | Server weight | 1000 |
proxysql.mysql.servers.[].maxReplicationLag | Server max replica lag | 0 |
proxysql.mysql.users.[].username | The user for connecting backend | nil |
proxysql.mysql.users.[].password | The user's password | nil |
proxysql.mysql.users.[].readOnly | Does the user is read only | false |
proxysql.mysql.users.[].maxConnections | The max connections that the proxysql can handle | 10000 |
proxysql.mysql.slave.enabled | Enable the traditional master/slave replication | false |
proxysql.mysql.slave.checkType | check read_only, use innodb_read_only for AWS Aurora | read_only |
proxysql.mysql.galera.enabled | Enable the Percona XtraDB Cluster | false |
proxysql.mysql.galera.maxWriters | The max writers that the proxySQL can use. | 1 |
proxysql.mysql.galera.writerAsReader | Use the writer as reader | true |
autoscaling.enabled | Enable Autoscaling for pods (only supported when proxysql.cluster.enabled is false) | false |
autoscaling.minReplicas | 1 | |
autoscaling.maxReplicas | 100 | |
autoscaling.targetCPUUtilizationPercentage | 80 | |
autoscaling.targetMemoryUtilizationPercentage | nil | |
resources | Compute Resource Quota | {} |
nodeSelector | Pod node selector | {} |
tolerations | Tolerations | [] |
affinity | Compute 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartproxysql is pinned at v1.7.0 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