<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.):</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.): same host name</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one): BUG</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>):<br>
Client Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.0.760+4dd0320db7cd3d-dirty", GitCommit:"4dd0320db7cd3df7b21a24efb13dabf662e73d4d", GitTreeState:"dirty", BuildDate:"2016-11-22T07:29:40Z", GoVersion:"go1.7.3", Compiler:"gc", Platform:"linux/amd64"}<br>
Server Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.0.760+4dd0320db7cd3d-dirty", GitCommit:"4dd0320db7cd3df7b21a24efb13dabf662e73d4d", GitTreeState:"dirty", BuildDate:"2016-11-22T07:29:40Z", GoVersion:"go1.7.3", Compiler:"gc", Platform:"linux/amd64"}</p>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li>
<p dir="auto"><strong>Cloud provider or hardware configuration</strong>:</p>
</li>
<li>
<p dir="auto"><strong>OS</strong> (e.g. from /etc/os-release):<br>
NAME="Ubuntu"<br>
VERSION="16.04.1 LTS (Xenial Xerus)"</p>
</li>
<li>
<p dir="auto"><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>):<br>
Linux freeworld 4.4.0-47-generic <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35537532" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/68" data-hovercard-type="pull_request" data-hovercard-url="/kubernetes/kubernetes/pull/68/hovercard" href="https://github.com/kubernetes/kubernetes/pull/68">#68</a>-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux</p>
</li>
<li>
<p dir="auto"><strong>Install tools</strong>:</p>
</li>
<li>
<p dir="auto"><strong>Others</strong>:<br>
I used my laptop as the master and node, and used a virtualbox machine installed the same OS as a the other node.</p>
</li>
</ul>
<p dir="auto"><strong>What happened</strong>:<br>
I set the same host name(--hostname-override=k8s-node1-192.168.0.105) in kubelet startup argument on both of two nodes by mistake.  Both of them successfully registered on the master.  if create a rc with replicas equal 2, you will see both of nodes have duplicate ones.  There are two pods on each node and the pods identical.  By the way if run "kubectl get no", it will show only one node.</p>
<p dir="auto"><strong>What you expected to happen</strong>:<br>
I think if there is a host name conflict, kubelet should fail to registered.  It means new node cannot be added in cluster.</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible):</p>
<ol dir="auto">
<li>set same host name using hostname-override to start kubelet on two nodes.</li>
<li>create a rc and schedule to those two nodes.</li>
<li>run "docker ps" on those two nodes to check result.</li>
</ol>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>
<p dir="auto">To avoid the unregister_netdevice race due to hairpin mode (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="32864464" data-permission-text="Title is private" data-url="https://github.com/moby/moby/issues/5618" data-hovercard-type="issue" data-hovercard-url="/moby/moby/issues/5618/hovercard" href="https://github.com/moby/moby/issues/5618">moby/moby#5618</a>, which is due to a kernel bug, maybe <a href="https://bugzilla.kernel.org/show_bug.cgi?id=81211" rel="nofollow">https://bugzilla.kernel.org/show_bug.cgi?id=81211</a>) we flipped the container bridge to promiscuous, but this has various side effects (performance hit, duplicate acks, martian packets etc).</p>
<p dir="auto">To workaround this we discussed a packet laundering ns, eg: <a href="https://gist.github.com/bprashanth/0e3c0cf8ef7fd21fc2e857c96eb6f4d0">https://gist.github.com/bprashanth/0e3c0cf8ef7fd21fc2e857c96eb6f4d0</a></p>
<p dir="auto">And adding 2 rules to the host:</p>
<ol dir="auto">
<li>DNAT packets going from an endpoint to the service into the laundering netns</li>
<li>Don't MASQ packets coming out of the laundering netns, just pass them back to the endpoint</li>
</ol>
<p dir="auto">This would probably mean that endpoints can never reach their peers thorugh the Service vip, I think that should be OK? (petset pods DNS lookup their peers through the Service, then use individual hostnames to talk to them).</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/girishkalele/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/girishkalele">@girishkalele</a></p>