I am using the HAProxy ingress controller in my EKS Kubernetes setup.
Recently I tried to set up a Redis instance on my k8s.
When I tried to connect and run any command from outside the cluster, I got the following error:
❱❱❱ redis-cli -h redis-ingress.local -p 80 info
Error: Protocol error, got "H" as reply type byte
On further debugging, I found the issue, that HAProxy needs to be running in TCP mode
, and it is failing as the default mode is set to HTTP
.
To solve this, I added the following annotation to my Redis-service, which should have solved the problem, but it didn't. I still keep getting the same error.
annotations:
haproxy.org/backend-config-snippet: |
mode tcp
I logged into one of the HAProxy containers to check the config, being used, and found the following block:
backend redis-service-redis
mode http
balance roundrobin
option forwardfor
###_config-snippet_### BEGIN
mode tcp
###_config-snippet_### END
server SRV_1 172.19.51.245:6379 check weight 128
server SRV_2 127.0.0.1:6379 disabled check weight 128
As I can see, the config from the annotation is being applied, but it is not overwriting the mode
.
I have few queries
- How to overwrite the
HTTP
or whatever the global mode is set for a particular backend/Service? - If both the
mode
are specified in thebackend
(as in the above case), which one takes the preference?