Connecting to redis cluster with sentinel on kubernetes

2/12/2016

I've successfully set up a password-protected redis cluster using the guide here:

http://kubernetes.io/v1.1/examples/redis/

I can connect to the sentinel just fine using redis-cli, but I cannot connect to the redis master/slave even though I have exposed the sentinels.

I'm using ruby and the following connection string.. Am I doing this wrong?

SENTINELS = [{host: "104.122.24.897", port: 26379}]

redis = Redis.new(url: "redis://mymaster", sentinels: SENTINELS, :role => :master, password: "longasspassword", timeout: 16)

The error I get is:

Error connecting to Redis on 10.64.7.33:6379 (Redis::TimeoutError) (Redis::CannotConnectError)`
-- sambehera
kubernetes
redis
redis-sentinel
ruby

1 Answer

2/14/2016

I eventually settled on using helm (https://helm.sh/) and installed redis-cluster using helm install redis-cluster.

I can connect to the redis cluster using the cluster_ip (not external ip) in kubernetes and this satisfies my security requirement. redis sentinel works out of the box with this approach.

-- sambehera
Source: StackOverflow