<p>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).</p>

<p>I have tried Kubernetes statefulset and deployment.
<br>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.
<br>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.</p>

<p><a href="https://github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-statefulset.md" rel="nofollow noreferrer">My redis-cluster statefulset config</a>
<br><a href="https://github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-deployment.md" rel="nofollow noreferrer">My redis-cluster deployment config</a></p>

<p><code>Redis-4.0.0</code> has solved this problem by adding support for <a href="https://github.com/antirez/redis/issues/2527" rel="nofollow noreferrer">cluster announce node IP and Port</a></p>

<p>Set <code>cluster-announce-ip</code> as static IP of service over redis instance kubernetes deployment.</p>

<p>Link to setup instructions: <a href="https://github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-statefulset.md" rel="nofollow noreferrer">https://github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-statefulset.md</a></p>
