<p>I have 1 question regarding pods scheduling for runner pods in k8s. As I can see, during different jobs It creates pods like runner-xxxx-project-xxxx-concurrent and this pods creating dynamically. How I can configure scheduling (nodeSelector) for this pods only (runner-xxxx-project-xxxx-concurrent), not for runner-gitlab-runner deployment?</p>

<p>First, depending on the way you have installed your master nodes, they usually have a taint <code>node-role.kubernetes.io/master:NoSchedule</code> to avoid scheduling of pods.</p>

<pre><code>$ kubectl describe nodes node1
Name:               node1
Roles:              master
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/hostname=node1
                    node-role.kubernetes.io/master=
Annotations:        node.alpha.kubernetes.io/ttl=0
                    volumes.kubernetes.io/controller-managed-attach-detach=true
Taints:             node-role.kubernetes.io/master:NoSchedule
</code></pre>

<p>So if your kubernetes install is conform, there is no need to use a <code>nodeSelector</code> to set the node where the pods are going to be scheduled (it is usually a bad practice).</p>

<p>First solution is to taint your master node for no scheduling if not done during install:</p>

<pre><code>kubectl taint nodes node1 node-role.kubernetes.io/master:NoSchedule-
</code></pre>

<p>Second solution: set label to nodes to use <code>nodeSelector</code></p>

<pre><code>kubectl label nodes node1 gitlab-runner=true
</code></pre>

<p>And use <code>nodeSelector</code> to indicate to scheduler you want node with a specific label:</p>

<pre><code>spec:
  containers:
  - [...]
  nodeSelector:
    gitlab-runner: "true"
</code></pre>

<p>As mentionned by <a href="https://stackoverflow.com/users/2653911/nicolas-pepinster">@Nicolas-pepinster</a>, you can set the label in the  <code>[runners.kubernetes]</code> section of our gitlab-runner (<a href="https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnerskubernetes-section" rel="nofollow noreferrer">see doc</a>).</p>
