HAProxy for MariaDB Galera Load Balancing
The HAProxy forwards requests to the available MariaDB Galera cluster nodes.
We use DNS discovery based on www.haproxy.com/de/blog/dns-service-discovery-haproxy/ to configure HAProxy backends.
A Kubernetes service type LoadBalancer
is used for client access to the HAProxy instance.
The HAProxy instance is scaled to two replicas for redundancy.
Installation and Configuration
For installing and configuring HAProxy, the APPUiO HAProxy Helm Chart is being used. It contains a ConfigMap (galerak8s) which configures the details.
Example Configuration
Example Helm Values
replicaCount: 2
service:
port: 3306
type: LoadBalancer
haproxy:
config: galerak8s
frontendPort: 3306
securityContext:
runAsUser: 1000
galerak8s:
dnsservice: galera-test-mariadb-galera-headless.default.svc.cluster.local
check:
enabled: false
metrics:
serviceMonitor:
enabled: true