<p>We're using Gitlab Runner with Kubernetes executor and we were thinking about what I think is currently not possible. We want to assign the Gitlab Runner daemon's pod to a specific node group's worker with instance type X and the jobs' pods to a different node group Y worker nodes as these usually require more computation resources than the Gitlab Runner's pod.</p>
<p>This comes in order to save costs, as the node where the Gitlab runner main daemon will always be running, then we want it to be running on a cheap instance, and later the jobs which need more computation capacity then they can run on different instances with different type and which will be started by the Cluster Autoscaler and later destroyed when no jobs are present.</p>
<p>I made an investigation about this feature, and the available way to assign the pods to specific nodes is to use the node selector or node affinity, but the rules included in these two configuration sections are applied to all the pods of the Gitlab Runner, the main pod and the jobs pods. The proposal is to make it possible to apply two separate configurations, one for the Gitlab Runner's pod and one for the jobs' pods.</p>
<p>The current existing config consists of the node selector and nodes/pods affinity, but as I mentioned these apply globally to all the pods and not to specified ones as we want in our case.</p>
<p>Gitlab Runner Kubernetes Executor Config: <a href="https://docs.gitlab.com/runner/executors/kubernetes.html" rel="nofollow noreferrer">https://docs.gitlab.com/runner/executors/kubernetes.html</a></p>

<p>This problem is solved! After a further investigation I found that Gitlab Runner's Helm chart provide 2 <code>nodeSelector</code> features, to exactly do what I was looking for, 1 for the main pod which represents the Gitlab Runner pod and the other one for the Gitlab Runner's jobs pods. Below I show a sample of the Helm chart in which I set beside each <code>nodeSelector</code> its domain and the pod that it affects.</p>
<p>Note that the first level <code>nodeSelector</code> is the one that affects the main Gitlab Runner pod, and the <code>runners.kubernetes.node_selector</code> is the one that affects the Gitlab Runner's jobs pods.</p>
<pre class="lang-yaml prettyprint-override"><code>gitlabUrl: https://gitlab.com/
...
nodeSelector:
  gitlab-runner-label-example: label-values-example-0
...

runnerRegistrationToken: ****
...
runners:
  config: 
    [[runners]]
        name = &quot;gitlabRunnerExample&quot;
        executor = &quot;kubernetes&quot;
        environment = [&quot;FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY=true&quot;]
        
        [runners.kubernetes]
            ...
        [runners.kubernetes.node_selector]
            &quot;gitlab-runner-label-example&quot; = &quot;label-values-example-1&quot;

        [runners.cache]
            ...
            [runners.cache.s3]
                ...
...

</code></pre>
