proxysql

by Dysnix

Helm chartv0.11.2App 2.5.5Verified publisher

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 dysnix https://dysnix.github.io/charts/
$ helm install my-release dysnix/proxysql

Introduction

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

Prerequisites

  • Kubernetes 1.12+
  • Helm 2.11+ or Helm 3.0-beta3+
  • PV provisioner support in the underlying infrastructure

Installing the Chart

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

$ helm install my-release dysnix/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
image.registryProxySQL image registrydocker.io
image.repositoryProxySQL Image nameproxysql/proxysql
image.tagProxySQL Image tag2.0.9
image.pullPolicyProxySQL image pull policyIfNotPresent
image.pullSecretsSpecify docker-registry secret names as an array[] (does not add image pull secrets to deployed pods)
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
service.typeKubernetes service typeClusterIP
service.clusterIPSpecific cluster IP when service type is cluster IP. Use None for headless servicenil
service.portProxySQL service port6033
serviceAccount.createSpecifies whether a ServiceAccount should be createdfalse
serviceAccount.nameThe name of the ServiceAccount to createGenerated using the proxysql.fullname template
securityContext.enabledEnable a container security contextfalse
podSecurityContext.runAsNonRootRun pod as unprivileged usertrue
podSecurityContext.fsGroupFilesystem group ID for the pod containers999
podSecurityContext.runAsUserRun pod containers with the specified user ID999
podSecurityContext.runAsGroupRun pod containers with the specified group ID999
podDisruptionBudget.enabledIf true, create a pod disruption budget for master pods.false
podDisruptionBudget.minAvailableMinimum number / percentage of pods that should remain scheduled1
podDisruptionBudget.maxUnavailableMaximum number / percentage of pods that may be made unavailable
admin_variables.admin_credentialsProxySQL admin credentials for the management (127.0.0.1:6032)admin:admin
admin_variables.debugProxySQL debug modefalse
mysql_variables.threadsThe number of background threads that ProxySQL uses in order to process MySQL traffic.4
mysql_variables.max_connectionsThe maximum number of client connections that the proxy can handle.2048
mysql_variables.default_query_delaySimple throttling mechanism for queries to the backends. Setting this variable to a non-zero value (in miliseconds) will delay the execution of all queries, globally.0
mysql_variables.default_query_timeoutMechanism for specifying the maximal duration of queries to the backend MySQL servers until ProxySQL should return an error to the MySQL client.3600000 milliseconds
mysql_variables.monitorEnables or disables MySQL Monitor module.false
mysql_usersDefines ProxySQL users configuration[]
mysql_serversDefines ProxySQL backend servers configuration[]
mysql_query_rulesDefines ProxySQL [Query Rules (routing)] (https://github.com/sysown/proxysql#configuring-proxysql-through-the-config-file)[]
ssl.autoAutomatically set use_ssl to 1 when the SSL configuration is providedtrue
ssl.caCA authority certificate to use""
ssl.certProxySQL SSL certificate""
ssl.keyProxySQL SSL key""
ssl.fromSecretSpecify a secret containing ca.pem, cert.pem and key.pem SSL configuration""

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, for example:

mysql_servers:
  - address: "172.17.0.1"
    port: 3306
    hostgroup: 0
    max_connections: 200

mysql_users:
  - username: "test"
    password: "p@ssword"
    default_hostgroup: 0
$ helm install my-release dysnix/proxysql -f values.yaml

The configuration is immutable thus the ProxySQL helm chart sets active to 1 for mysql_users and substitutes the rule_id for mysql_query_rules automatically.

SSL configuration

ProxySQL can be used to safely route unencrypted MySQL traffic from applications wrapping it into SSL in case these applications do not support SSL configuration. To enable this you need to provide ssl.* options. When either ssl.fromSecret or ssl.cert together with ssl.key is provided and the ssl.auto is set to true (which is default) mysql_servers will get use_ssl set to 1 automatically if not specifically provided.

ProxySQL and MySQL 8.0

ProxySQL supports MySQL 8.0 , although there are some limitations for the details refer to the documentation.

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 v0.11.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