[stable/redis-ha] Enable sticky connections balancing via HAProxy. (#19589)

I just found that python Redis client (Sentry, Weblate) is having trouble with HAProxy + Redis HA scheme.
It seems like HAProxy balance source + hash-type consistent does the trick.

Signed-off-by: Andrey Voronkov <avoronkov@enapter.com>
This commit is contained in:
Andrey Voronkov
2019-12-18 08:31:57 -08:00
committed by Kubernetes Prow Robot
parent a494c6bb4a
commit b4ac7ad5ca
4 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ keywords:
- redis
- keyvalue
- database
version: 4.1.6
version: 4.2.0
appVersion: 5.0.6
description: Highly available Kubernetes implementation of Redis
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
+1
View File
@@ -108,6 +108,7 @@ The following table lists the configurable parameters of the Redis chart and the
| `haproxy.service.type` | HAProxy service type "ClusterIP", "LoadBalancer" or "NodePort" | `ClusterIP` |
| `haproxy.service.nodePort` | HAProxy service nodePort value (haproxy.service.type must be NodePort) | not set |
| `haproxy.service.annotations` | HAProxy service annotations | `{}` |
| `haproxy.stickyBalancing` | HAProxy sticky load balancing to Redis nodes. Helps with connections shutdown. | `false` |
| `haproxy.hapreadport.enable` | Enable a read only port for redis slaves | `false` |
| `haproxy.hapreadport.port` | Haproxy port for read only redis slaves | `6380` |
| `haproxy.metrics.enabled` | HAProxy enable prometheus metric scraping | `false` |
+8
View File
@@ -185,6 +185,10 @@
{{- end }}
# Check all redis servers to see if they think they are master
backend bk_redis_master
{{- if .Values.haproxy.stickyBalancing }}
balance source
hash-type consistent
{{- end }}
mode tcp
option tcp-check
tcp-check connect
@@ -204,6 +208,10 @@
{{- end }}
{{- if .Values.haproxy.readOnly.enabled }}
backend bk_redis_slave
{{- if .Values.haproxy.stickyBalancing }}
balance source
hash-type consistent
{{- end }}
mode tcp
option tcp-check
tcp-check connect
+3
View File
@@ -40,6 +40,9 @@ haproxy:
pullPolicy: IfNotPresent
annotations: {}
resources: {}
## Enable sticky sessions to Redis nodes via HAProxy
## Very useful for long-living connections as in case of Sentry for example
stickyBalancing: false
## Kubernetes priorityClass name for the haproxy pod
# priorityClassName: ""
## Service type for HAProxy