maxscale

by SVTECH-NMAA

Helm chartv1.9.0App v1.0.0Verified publisher

SVTECH Maxscale

About this chart

maxscale

Helm chart deploying a MariaDB MaxScale pod in front of a MariaDB/Galera backend (or an external MariaDB/Galera cluster), plus a mariadb ClusterIP Service exposing one port per configured router.

What this chart deploys

  • A single Deployment running the svtechnmaa/svtech_maxscale image, with an init container that waits until the backend database(s) accept connections before MaxScale itself starts.
  • A mariadb Service (ClusterIP, or with externalIPs set) with one port per entry in routers, so each router is reachable as its own MySQL-protocol endpoint.
  • Router/monitor configuration is driven entirely by environment variables derived from values.yaml — there is no static maxscale.cnf shipped with the chart. Monitors are not declared in values at all; the image auto-derives them from probing the backends (see How monitors work).

Values reference

KeyTypeDefaultDescription
replicaCountint2MaxScale pod replica count.
priorityClassNamestring""Pod priorityClassName (e.g. system-cluster-critical). Empty leaves it unset.
tolerationslist[]Pod tolerations (e.g. to tolerate node.kubernetes.io/disk-pressure).
image.registrystringghcr.ioRegistry for the MaxScale image.
image.repositorystringsvtechnmaa/svtech_maxscaleMaxScale image repository.
image.tagstringv1.0.10MaxScale image tag. v1.0.10+ is required for the routers[*].servers / routers[*].params fields below — older tags ignore those env vars but keep working via the legacy path.
image.pullPolicystringIfNotPresentImage pull policy.
init.image.*objectsvtechnmaa/mysql:8.2.0Image used by the wait-for-mariadb init container.
service.externalIPslist[]Reserved for future use (see global.externalIP for the currently-wired external IP).
maxscaleConfig.serverlist3 internal dbNN://host:port entriesBackend server list, used only when global.mariadb-galera.enabled is false (external database mode). Ignored when the bundled mariadb-galera subchart is enabled.
maxscaleConfig.auth.usernamestringmaxscale_monitorDB user MaxScale uses to monitor backend health.
maxscaleConfig.auth.passwordstring""Empty generates a password; set the current DB account password or use an external Secret.
routerslistone rwsplit entry (see below)List of MaxScale router services to expose. Each entry becomes a router inside the container and a port on the mariadb Service.
routers[*].idstring—Router identifier. Becomes the MXS_<id>_* env var prefix and the Service port name.
routers[*].typestring—MaxScale router type: readwritesplit, readconnroute, or schemarouter.
routers[*].portint—Container port the router listens on.
routers[*].servicePortint—Port exposed on the mariadb Service for this router.
routers[*].serverslist of string(unset)Optional. Scopes this router to a backend subset (MXS_<id>_SERVERS). Omit to attach every backend. Requires image v1.0.10+.
routers[*].paramsmap(unset)Optional. Free-form router tuning parameters, rendered as MXS_<id>_<KEY> (key upper-cased) per entry. See the image README's router parameter reference for the full list per router type. Requires image v1.0.10+.
routers[*].optionsstring(unset)Legacy free-text MXS_<id>_ROUTER_OPTIONS string. Still supported for backward compatibility; prefer params.router_options in new configs.

Router configuration

  • readwritesplit — splits reads and writes across the backend subset, sending writes to the current primary and load-balancing reads across replicas/other nodes. Pick this for a standard OLTP application connection that shouldn't have to know about the topology.
  • readconnroute — routes every connection to servers matching a fixed role (master, slave, or a combination via params.router_options), without read/write splitting. Pick this for a dedicated write endpoint that follows failover, or a read-only offload endpoint for reporting/analytics traffic.
  • schemarouter — routes by schema/database name rather than by role, and is the only router type allowed to span two different topologies in servers (e.g. one Galera cluster and one standalone node). Pick this when different schemas live on different backend topologies and the application connects through one endpoint.

Examples

The same three recipes are also available as commented-out blocks directly in values.yaml, ready to copy-paste over the default routers: list.

1. rwsplit with causal reads — use this when the application needs read-your-writes consistency against a Galera cluster (an immediate read after a write must see that write, even if it lands on a different node):

routers:
  - id: rwsplit
    type: readwritesplit
    port: 4006
    servicePort: 3306
    params:
      causal_reads: universal

2. readconnroute pinned to master — use this when you want a single write endpoint that always resolves to the current primary, transparently following failover:

routers:
  - id: write
    type: readconnroute
    port: 4007
    servicePort: 3307
    params:
      router_options: master

3. Multi-router mix — use this when OLTP traffic needs read/write splitting, reporting traffic should be offloaded to replicas, and a separate schema-routed endpoint needs to span two topologies:

routers:
  - id: rwsplit
    type: readwritesplit
    port: 4006
    servicePort: 3306
    servers: [g1, g2, g3]
  - id: readoffload
    type: readconnroute
    port: 4008
    servicePort: 3308
    servers: [g1, g2, g3]
    params:
      router_options: slave
  - id: schema
    type: schemarouter
    port: 4009
    servicePort: 3309
    servers: [g1, m1]

How monitors work

Chart values never declare monitors. When any routers[*].servers is set, the image probes the declared backends at boot, groups them into topologies (Galera cluster, replication chain, or standalone node), and creates exactly the monitors each router's server subset needs — reusing one monitor per topology across routers that share it. If no router sets servers, the pod falls back to the original legacy behaviour: one monitor covering every backend, shared by every router. See the image README's How auto-monitoring works section for the full topology-detection and guard-rail details.

Monitor credentials

maxscaleConfig:
  auth:
    username: maxscale_monitor
    password: ""  # Empty: generate 32 characters; non-empty: use this value.
    existingSecret: ""
    existingSecretPasswordKey: MONITOR_PASSWORD

Choose a password source

ScenarioConfiguration
Existing MariaDB monitor accountSet auth.password to its current password and auth.existingSecret: "".
Existing Kubernetes SecretSet auth.existingSecret and auth.existingSecretPasswordKey; keep the matching auth.username.
Generate a new passwordLeave password and Secret reference empty; provision the MariaDB account with the generated password separately.

For example, a standalone chart consuming an existing monitor Secret:

maxscaleConfig:
  auth:
    username: maxscale_monitor
    existingSecret: database-auth
    existingSecretPasswordKey: maxscale-password

Create this Secret in the release namespace. Configure maxscaleConfig.server for external MariaDB backends using the router examples above. Auto-generation only creates a Kubernetes credential; it cannot log in to an already provisioned DB with a different password. Upgrades reuse a stored managed password rather than rotate it when auth.password changes.

Deploy maxscale with OpenTenant

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