<p>I was wondering if there is a way to create a service for a pod on a specific node.
For example:</p>
<p>Lets say I have a cluster with 4 worker nodes [compute-0 ... compute-3].</p>
<p>Nodes &quot;compute-0&quot; and &quot;compute-1&quot; have a label &quot;app=firstApplication&quot;</p>
<p>Nodes &quot;compute-2&quot; and &quot;compute-3&quot; have a different label &quot;app=secondApplication&quot;</p>
<p>I have a single Daemonset running across all 4 nodes.</p>
<p>I want to create 2 services, one for each couple of nodes.
Is this possible somehow?</p>
<p>Thanks!</p>
<p><strong>EDIT</strong></p>
<p>The reason for what we are trying to do is that we have an Openshift4.6 cluster, and for security reasons we have VXLAN port blocked off between 2 groups of nodes. When pods try to resolve DNS queries using the default dns service (172.30.0.10), sometimes they access the dns pods on the blocked off nodes.</p>

Linux Devops
<p><strong>No - this is not possible!</strong> Since services are referencing their Pods by Labels and all Pods in a DaemonSet are labelled the same, you can't do that. Of course, you could label your Pods after creation, but since this would be lost after recreation of the DaemonSet, I would not go down that route.</p>
<p>You could split your DaemonSet into parts and use <a href="https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#running-pods-on-select-nodes" rel="nofollow noreferrer">Node Selectors or Affinity</a> to control the distribution of Pods over Nodes.</p>
<blockquote>
<p>If you specify a .spec.template.spec.nodeSelector, then the DaemonSet controller will create Pods on nodes which match that node selector. Likewise if you specify a .spec.template.spec.affinity, then DaemonSet controller will create Pods on nodes which match that node affinity.</p>
</blockquote>
<p>That way, each DaemonSet can have its own Service.</p>
