<p>I'm following <a href="https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-type-nodeport" rel="nofollow noreferrer">this</a> guide to preserve source ip for service type nodeport.</p>
<blockquote>
<p>kubectl create deployment source-ip-app --image=k8s.gcr.io/echoserver:1.4</p>
</blockquote>
<blockquote>
<p>kubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080</p>
</blockquote>
<p>At this point my service is accessible externally with nodeip:nodeport</p>
<p>When I change the service traffic policy,</p>
<blockquote>
<p>kubectl patch svc nodeport -p '{&quot;spec&quot;:{&quot;externalTrafficPolicy&quot;:&quot;Local&quot;}}'</p>
</blockquote>
<p>my service is not accessible.</p>
<p>I found a similar <a href="https://stackoverflow.com/questions/47345327/why-unable-to-access-a-service-if-setting-externaltrafficpolicy-to-local-in-a-ku">issue</a>  , But the solution is not much helpful or not understandable for me . I saw some github threads which says its something to do with hostname override in kube proxy , I'm not clear with it too.</p>
<p>I'm using kubernetes version v1.15.3. Kube proxy is running in iptables mode. I have a single master node and few worker nodes.
I'm facing the same issue in my minikube too.</p>
<p>Any help would be greatly appreciated.</p>

Noone
<p>From the docs <a href="https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-type-nodeport" rel="nofollow noreferrer">here</a></p>
<blockquote>
<p>If there are no local endpoints, packets sent to the node are dropped</p>
</blockquote>
<p>So you need to use the correct node IP of the kubernetes node to access the service. Here correct node IP is the node's IP where the pod is scheduled.</p>
<p>This is not necessary if you can make sure every node(master and workers) has a replica of the pod.</p>
