<p>I have a DaemonSet with a service pointing to it.
When a pod will access the ClusterIP of the my service, will it get the local pod running on the same node or any pod in the service?</p>
<p>Is there any way to achieve this? My understanding is that it would be the same thing than <code>externaltrafficpolicy: local</code> but for internal traffic.</p>

ITChap
<blockquote>
<p>By default, traffic sent to a ClusterIP or NodePort Service may be routed to any backend address for the Service. Since Kubernetes 1.7 it has been possible to route &quot;external&quot; traffic to the Pods running on the Node that received the traffic, but this is not supported for ClusterIP Services, and more complex topologies — such as routing zonally — have not been possible. The Service Topology feature resolves this by allowing the Service creator to define a policy for routing traffic based upon the Node labels for the originating and destination Nodes.</p>
</blockquote>
<p>You need to use: <a href="https://kubernetes.io/docs/concepts/services-networking/service-topology/" rel="nofollow noreferrer">Service topology</a></p>
<p>An example service which prefers local pods:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: my-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 9376
  topologyKeys:
    - &quot;kubernetes.io/hostname&quot;
    - &quot;*&quot;
</code></pre>
<hr />
<p><strong>UPD 1:</strong></p>
<p>There is another option to make sure, that requests sent to a port of some particular node will be handled on the same node - it's <code>hostPort</code>.</p>
<p>An example:</p>
<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: test-api
  labels:
    app: test-api
spec:
  containers:
  - name: testapicontainer
    image: myprivaterepo/testapi:latest
    ports:
    - name: web
      hostPort: 55555
      containerPort: 80      
      protocol: TCP
</code></pre>
<p>The above pod will expose container port <code>80</code> on a <code>hostPort: 55555</code> - if you have <code>DaemonSet</code> for those pods - then you can be sure, that they will be run on each node and each request will be handled on the node which received it.</p>
<p>But, please be careful using it and read this: <a href="https://kubernetes.io/docs/concepts/configuration/overview/" rel="nofollow noreferrer">Configuration Best Practices</a></p>
