<p>I use the K8s example the create a Reliable, Scalable Redis on Kubernetes.
<a href="https://github.com/kubernetes/kubernetes/tree/master/examples/redis" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/tree/master/examples/redis</a></p>

<p>The Redis master needs to get slave the origin IP and register to the sentinel. Sentinel will use to switch master when the master failed. </p>

<p>But My docker starts without the flag iptables=false(It will create an iptables like SNAT), so the redis slave source IP will be SNAT, and the master will get the flannel0's IP like 172.16.103.0.</p>

<p>I also add the flannel network to container connection between nodes.</p>

<p>So the question is "Is any way to get the source IP without removing the iptables flag, or another way to create a  Reliable redis cluster."</p>

zhulinhong
<p>EDIT: I have figured out the magic combination of flags to get this working.</p>

<p>1) run stop docker &amp; the bootstrap docker processes  </p>

<pre><code>systemctl stop docker &amp;&amp; pkill -f "docker-bootstrap" &amp;&amp; sleep 10  
</code></pre>

<p>2) Delete iptables rules:  </p>

<pre><code>iptables -F &amp;&amp; iptables -t nat -F  
</code></pre>

<p>3) run your docker-daemon with the ip-masq=false option<br>
4) run your flanneld with the ip-masq=true option  </p>

<p>For me this makes all three pod->pod, pod->ext, &amp; ext->service->pod work perfectly.  </p>

<p>Hope this works for the rest of you!  </p>

<hr>

<p>(Preserving initial response which described the symptoms)</p>

<p>I am having the same problem with the guide. The slave replicates just fine but the master can't properly check the slave status because the connection is coming from the dot zero ip. </p>

<pre><code>Proto Recv-Q Send-Q Local Address           Foreign Address         State      
</code></pre>

<p>Example slave->master connection from the master perspective (shows wrong IP of slave):</p>

<pre><code>tcp   0      0 redis-master:6379       10.1.37.0:51674         ESTABLISHED
</code></pre>

<p>Example slave->master connection from slave perspective (shows right ip of master):</p>

<pre><code>tcp   0      0 redis-03fdy:51674       10.1.90.2:6379          ESTABLISHED
</code></pre>

<p>Here are the redis server commands from ps.</p>

<p>master:</p>

<pre><code>root   12  0.1  0.2  26876  2352 ?   Sl   10:42   0:02 redis-server 10.1.90.2:6379
</code></pre>

<p>slave:</p>

<pre><code>root   18  0.1  0.2  26876  2300 ?   Sl   10:48   0:00 redis-server 10.1.37.3:6379
</code></pre>
