Jenkins maven builds won't start with error "cannot watch resource configmaps"

Solution Verified - Updated -

Issue

  • Build starts but is stuck "waiting on Maven"
  • Jenkins JNLP pod log error

    WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch Error in provisioning; agent=KubernetesSlave name: maven-8bd18, template=PodTemplate{inheritFrom='', name='maven', slaveConnectTimeout=0, label='maven', serviceAccount='jenkins', nodeSelector='', workspaceVolume=EmptyDirWorkspaceVolume [memory=false], containers=[ContainerTemplate{name='jnlp', image='image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-maven:latest', alwaysPullImage=true, workingDir='/tmp', command='', args='${computer.jnlpmac} ${computer.name}', resourceRequestCpu='', resourceRequestMemory='', resourceLimitCpu='', resourceLimitMemory=''}]}
        java.lang.IllegalStateException: Agent is not connected after 4 seconds, status: Failed
        at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:208)
        at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:292)
        at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
        at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        ...
    
  • Jenkins pod shows error:

    2020-08-18 20:41:54 WARNING io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager$1 onFailure Exec Failure: HTTP 403, Status: 403 - configmaps is forbidden: User "system:serviceaccount:jenkins-namespace:jenkins" cannot watch resource "configmaps" in API group "" in the namespace "jenkins-namespace"
        java.net.ProtocolException: Expected HTTP 101 response but was '403 Forbidden'
                at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:229)
                at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:196)
                at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
                ...
    

Environment

  • Red Hat OpenShift Container Platform (Openshift) 3, 4
  • Red Hat OpenShift Dedicated (Openshift Dedicated) 3, 4
  • Red Hat Managed Integration (RHMI) 1, 2
  • Jenkins
  • Maven build with JNLP agent
  • Jenkins agent running in the same namespace.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content