title: constraining jobs to specific nodepool in kubernetes AKS cluster
body: <p>I am not able to get the nodeselector feature working. I have both Linux as well as windows nodepools in the AKS cluster. I am trying to use the nodeselector config in the UI to start the pods based on the label. In the Node Selector field under the Pod Templates section, I specify the label as “agentpool=linpool”. This label is present in the nodepools as verified below -</p>
  <p>NAME STATUS ROLES AGE VERSION AGENTPOOL<br />
  aks-contpool-14153102-vmss000000 Ready agent 67d v1.22.6 contpool<br />
  aks-contpool-14153102-vmss000001 Ready agent 67d v1.22.6 contpool<br />
  aks-contpool-14153102-vmss000002 Ready agent 67d v1.22.6 contpool<br />
  aks-linpool-22505568-vmss000000 Ready agent 67d v1.22.6 linpool<br />
  aks-linpool-22505568-vmss000001 Ready agent 67d v1.22.6 linpool<br />
  aks-linpool-22505568-vmss000002 Ready agent 67d v1.22.6 linpool<br />
  aks-nodepool1-42852156-vmss000000 Ready agent 67d v1.22.6 nodepool1<br />
  aks-nodepool1-42852156-vmss000001 Ready agent 67d v1.22.6 nodepool1<br />
  aks-nodepool1-42852156-vmss000002 Ready agent 67d v1.22.6 nodepool1<br />
  akswipool000001 Ready agent 67d v1.22.6 wipool<br />
  akswipool000002 Ready agent 67d v1.22.6 wipool<br />
  akswipool000005 Ready agent 3d v1.22.6 wipool</p>
  <p>In the pipeline script that I use for testing, I refer to the nodepool as follows -</p>
  <p>pipeline {<br />
  agent { label ‘linpool’ }</p>
  <p>The job keeps running forever with the following message -</p>
  <p>[Pipeline] Start of Pipeline<br />
  [Pipeline] node<br />
  Still waiting to schedule task
  Waiting for next available executor</p>
  <p>When I check the pod logs, I see the following -</p>
  <p>3s          Normal    Pulled        pod/linpool-x6bj6   Container image &quot;jenkins/inbound-agent:4.11.2-4&quot; already present on machine<br />
  2s          Normal    Started       pod/linpool-x6bj6   Started container jnlp<br />
  2s          Normal    Created       pod/linpool-x6bj6   Created container jnlp<br />
  1s          Warning   FailedMount   pod/linpool-x6bj6   MountVolume.SetUp failed for volume &quot;kube-api-access-5qjw7&quot; : object &quot;jenkins-staging&quot;/&quot;kube-root-ca.crt&quot; not registered</p>
  <p>It keeps creating new pods again &amp; again, but the job doesn't run</p>
  <p>And the controller logs -</p>
  <p>2022-06-21 08:59:53.440+0000 [id=5766]  INFO    o.c.j.p.k.KubernetesSlave#_terminate: Terminating Kubernetes instance for agent linpool-r5jhh</p>
  <p>2022-06-21 08:59:53.445+0000 [id=5766]  SEVERE  o.c.j.p.k.KubernetesSlave#_terminate: Computer for agent is null: linpool-r5jhh</p>
  <p>2022-06-21 08:59:53.445+0000 [id=5766]  INFO    hudson.slaves.AbstractCloudSlave#terminate: FATAL: Computer for agent is null: linpool-r5jhh</p>
  <p>If I don't use a label for nodeselector, the job runs fine.</p>
  <p>Can someone please guide how to get this working? If needed, I can provide additional details.</p>
  <p>Kubernetes version - 1.22.6</p>
  <p>Best regards,
  Sam</p>