1
votes

I am trying to setup redis cluster on Kubernetes. One of my requirements is that my redis cluster should be resilient in case of kubernetes cluster restart(due to issues like power failure).

I have tried Kubernetes statefulset and deployment.
In case of statefulset, on reboot a new set of IP addresses are assigned to Pods and since redis cluster works on IP addresses, it is not able to connect to other redis instance and form cluster again.
In case of services with static IP over individual redis instance deployment, again redis stores IP of Pod even when I created cluster using static service IP addresses, so on reboot it is not able to connect to other redis instance and form cluster again.

My redis-cluster statefulset config
My redis-cluster deployment config

2

2 Answers

3
votes

Redis-4.0.0 has solved this problem by adding support for cluster announce node IP and Port

Set cluster-announce-ip as static IP of service over redis instance kubernetes deployment.

Link to setup instructions: https://github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-statefulset.md

0
votes

Are you able to use DNS names instead of IP addresses? I think that is the preferred way to route your traffic to individual nodes in a statefulset:

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-network-id