<p>In my cluster, I have one node vm1, with label "kubernetes.io/hostname: vm-1". Can I configure to assign all Pod slaves to vm-1 node? I tries to set "Node Selector" in Jenkin > Configuration > cloud but it does not work.</p>

<p>Thanks,</p>

<p>All you need to do is specify this in the <code>Deployment</code> of your jenkins slave with <code>nodeAffinity</code>, like so:</p>

<pre><code>---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins-slave
  namespace: ci
  labels:
    app: jenkins
    role: slave
spec:
  selector:
    matchLabels:
      app: jenkins
      role: slave
  template:
    metadata:
      labels:
        app: jenkins
        role: slave
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: In
                    values:
                      - vm-1
</code></pre>

<p>You can see some examples <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity" rel="nofollow noreferrer">here</a></p>

<p>However, I am not sure if <code>kubernetes.io/hostname</code> is a valid label to be used when selecting node affinity, maybe you will need to create one, such as <code>role</code>, <code>dedicated</code> or <code>type</code>.</p>
