How to configure Spring redis sentinel in kubernetes
First thing -> using the bitnami helm chart is the right way to do things.
Although a bit of a different implementation, heres how we implemented the same master slave setup AND also avoided the above problem while ensuring the MAXIMUM availability we ever witnessed (less than 2 secs Downtime for master)
We made two services - one for master and another for slaves.
a PV PVC that was shared between the slaves and master where ONLY Master would write and slaves would only read from PV
this way we could always ensure that there was 1 pod running ALL time for master and N replicas behind the headless service for slaves.
In application slaves and master URL's would always be different, thus ensuring a clear "WRITE" and "READ" isolation and improving the stability of system with almost no failures for reads.
Install the helm chart with sentinel enabled
helm install my-release bitnami/redis --set sentinel.enabled=true
A service with name my-release-redis
will be created and can be accessed via my-release-redis.namespacename.svc.cluster.local:26379
from any namespace and from the same namespace it's much simpler using my-release-redis:26379