<p>i want to schedule 10 pods in two specific node(total 15 nodes in our kube cluster).</p>

<p>so in replication-controller file i am mentioning two values in nodeSelector
like below.  </p>

<pre><code>nodeSelector:  
  app: node1  
  app: node2  
</code></pre>

<p>problem is that all the time it's taking only node2.whatever sequence i am  mentioning, it's taking last node only.</p>

<p>note: <code>node1</code> and <code>node2</code> are lables of node.</p>

<p>The better way is in using something like this:</p>

<pre><code>  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: kubernetes.io/hostname
            operator: In
            values:
            - node1
            - node2
</code></pre>
