Build Agents are not getting provisioned when using .Agents.SeparateNamespace

Article ID:360059043232
1 minute readKnowledge base


  • I am using a separate namespace for build agent pods with the helm attribute .Agents.SeparateNamespace but Build Agents do not get provisioned

  • When trying to provision a build agent pod, the controller shows issues like the following:

      2021-02-01 19:54:15.065+0000 [id=31]	WARNING	o.c.j.p.k.KubernetesCloud#provision: Failed to count the # of live instances on Kubernetes
      io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: Message: Forbidden!Configured service account doesn't have access. Service account may have been revoked. pods is forbidden: User "system:serviceaccount:cloudbees-core:jenkins" cannot list resource "pods" in API group "" in the namespace "cloudbees-core".
          at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(
          at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(
          at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(
          at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(
          at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(
          at io.fabric8.kubernetes.client.dsl.base.BaseOperation.listRequestHelper(
          at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(
          at io.fabric8.kubernetes.client.dsl.base.BaseOperation.list(
          at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.getPodsWithLabels(
          at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.provision(


This is caused by a change / improvement made to the Kubernetes plugin #835 in version 1.28.0. When the Kubernetes plugin check for existing live instances of agent pods (to calculate if within the limits), it uses the namespace configured in the Kubernetes Cloud. However, CloudBees CI does not explicitly configure the Kubernetes Cloud with the agent namespace when using .Agents.SeparateNamespace.


The issue has been resolved in CloudBees CI

Upgrade CloudBees CI to version or later.


In Operations Center, in the configuration of the "kubernetes shared cloud" set the "Kubernetes Namespace" to the same value as the one used for the helm attribute .Agents.SeparateNamespace.