Redis with Kubernetes

Hi,
I’m currently connecting to a Redis with Sentinel through Kubernetes. (I’ve 3 redis nodes, 3 sentinels, and currently 2 services)

redis-1:  10.240.30.3
redis-2:  10.240.30.4
redis-3:  10.240.30.5
redis-sentinel-1:  10.240.30.6
redis-sentinel-2:  10.240.30.7
redis-sentinel-3:  10.240.30.8

redis-service: 10.30.10.10
redis-sentinal-service: 10.30.10.11

Kubernetes services are effectively doing a stateless TCP proxy round-robin between the 3 nodes they front. So I can’t connect to the master Redis through a service, as the service IP will round-robin between the 3 redis nodes and give me read-only slave some of the time. The round robin will also happen for the Sentinel service. I’m wondering if you can forsee and issues with connecting the sentinel to the service IP.

var sentinelHosts = new[]{ "redis-sentinal-service:26379" };
return sentinel.Start();

Or if I have sentinel.ScanForOtherSentinels = true; will that find the other sentinels based on their pod IP anyway? And will it matter that the service sentinel will also be a pod one? (i.e. it might find 4 sentinels when it scans, two of which are the same one with a different IP).

Thanks,
Chris

I have no experience with Kubernetes so can’t speak to any behavior specific to it, but ScanForOtherSentinels is used to query the configured Sentinel (i.e. the RedisSentinel instance is configured with) for other Sentinel Hosts it knows about. So the master source of information maintaining the list of active Sentinels is maintained within the Redis Sentinel instance itself, i.e. the RedisSentinel instance doesn’t go scanning the network for Sentinel instances.