Error while launching agent

Hi team,
we have setup Jenkins on GKE cluster. The UI comes up normally. I tried creating a free style project but while the agent is launching I get this error

2023-09-03 11:06:16.103+0000 [id=82] INFO o.c.j.p.k.KubernetesSlave#_terminate: Terminating Kubernetes instance for agent default-6m00p
2023-09-03 11:06:16.103+0000 [id=82] WARNING o.c.j.p.k.KubernetesSlave#deleteSlavePod: Failed to delete pod for agent null/default-6m00p: namespace cannot be null
io.fabric8.kubernetes.client.KubernetesClientException: namespace cannot be null
at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.inNamespace(BaseOperation.java:245)
at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.inNamespace(BaseOperation.java:92)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave.deleteSlavePod(KubernetesSlave.java:357)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave._terminate(KubernetesSlave.java:343)
at hudson.slaves.AbstractCloudSlave.terminate(AbstractCloudSlave.java:88)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:259)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:298)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
2023-09-03 11:06:16.108+0000 [id=82] INFO o.c.j.p.k.KubernetesSlave#_terminate: Disconnected computer default-6m00p
2023-09-03 11:06:16.115+0000 [id=41] INFO hudson.slaves.NodeProvisioner#update: default-6m00p provisioning successfully completed. We have now 1 computer(s)
2023-09-03 11:06:17.104+0000 [id=82] WARNING o.c.j.p.k.KubernetesLauncher#launch: Error in provisioning; agent=KubernetesSlave name: default-t2hrs, template=PodTemplate{id=‘a6e410bbc54d23e84ac3f58bd1608da0e09b1ef712ce19292fc4c1ee6c8add69’, name=‘default’, namespace=‘dev-ns’, slaveConnectTimeout=100, label=‘dev-app-jenkins-agent’, serviceAccount=‘default’, nodeUsageMode=NORMAL, podRetention=‘Never’, containers=[ContainerTemplate{name=‘jnlp’, image=‘jenkins/inbound-agent:3107.v665000b_51092-15’, workingDir=‘/home/jenkins/agent’, args=‘{computer.jnlpmac} {computer.name}’, resourceRequestCpu=‘512m’, resourceRequestMemory=‘512Mi’, resourceLimitCpu=‘512m’, resourceLimitMemory=‘512Mi’, envVars=[KeyValueEnvVar [getValue()=http://jenkins.dev-ns.svc.cluster.local:8080/, getKey()=JENKINS_URL]]}]}
java.lang.IncompatibleClassChangeError: Found class io.fabric8.kubernetes.api.model.VolumeFluent$EmptyDirNested, but interface was expected
at org.csanchez.jenkins.plugins.kubernetes.volumes.workspace.EmptyDirWorkspaceVolume.buildVolume(EmptyDirWorkspaceVolume.java:63)

1 Like

Welcome back @shafemoh. :wave:

Which version of Jenkins and Kubernetes plugin are you using?

After a restart of our Jenkins controller pod, we started to experience this issue. I’ve tried a few things in order to resolve it and unblock our team.

We experienced it on Jenkins 2.401.3 with Kubernetes plugin 3971.v94b_4c914ca_75
I’ve also tried to update Jenkins to 2.414.1 and with no change.

It appears to me like its trying to do something with the workspace volume mounting that it implicitly injects into pod templates, I’ve also tried to create this volume mount in the pod template explicitly and it didn’t make a difference.

Any ideas on a resolution?

EDIT: I had forgotten we downgraded the Kubernetes plugin to 3971.v94b_4c914ca_75 as one of our resolution attempts, after upgrading Jenkins and then restoring the Kubernetes plugin back to 4029.v5712230ccb_f8 it resolved.

1 Like

Hi @poddingue We are currently using 1.27.3-gke.100 of K8s on GKE and kubernetes:3937.vd7b_82db_e347b_ of the K8s plugin.

Hi guys,
I just tried to upgrade the k8s plugin to latest version 4029.v5712230ccb_f8 and it solved the issue. Strange that I had been using the older version 3937.vd7b_82db_e347b_ all these days and it was working fine and suddenly the same older version started causing issues…
Btw, I use Jenkins v2.401.2 (Helm way of installing Jenkins)

1 Like

Thanks a lot for your feedback, folks. :+1:

1 Like

Thank you! Finding this post saved us hours of extra work

1 Like

Thank you, @shafemoh it’s helped me a lot:smile: :v:

1 Like