1

I have installed a k8s cluster (v1.25.4+k3s1) and I have deployed a jenkins image to that cluster (using this guide) which means that I have the following installed:

Name Version
Jenkins v2.375.1
jvm 11.0.17+8
Kubernetes plugin 3743.v1fa_4c724c3b_7

When I then try to set up workers on this setup using another guide, I get this error (when starting the job):

Jan 10, 2023 7:47:16 PM WARNING org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper watchCloud

failed to set up watcher on kubernetes
io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar
at io.fabric8.kubernetes.client.utils.HttpClientUtils.getHttpClientFactory(HttpClientUtils.java:164)
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:145)
at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:56)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesFactoryAdapter.createClient(KubernetesFactoryAdapter.java:147)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesClientProvider.createClient(KubernetesClientProvider.java:59)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.connect(KubernetesCloud.java:523)
at org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper.watchCloud(Reaper.java:220)
at org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper.preLaunch(Reaper.java:122)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:296)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:48)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:82)
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)

Jan 10, 2023 7:47:16 PM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch

Error in provisioning; agent=KubernetesSlave name: kube-slave-tq3z1, template=PodTemplate{id='282a0649-b2c7-4a9b-9ee2-0721a8da7ed7', name='kube-slave', namespace='devops-workers', label='kube-slave'}
io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar
at io.fabric8.kubernetes.client.utils.HttpClientUtils.getHttpClientFactory(HttpClientUtils.java:164)
at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:145)
at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:56)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesFactoryAdapter.createClient(KubernetesFactoryAdapter.java:147)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesClientProvider.createClient(KubernetesClientProvider.java:59)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.connect(KubernetesCloud.java:523)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:120)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:298)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:48)
at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:82)
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)

Jan 10, 2023 7:47:16 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate

Terminating Kubernetes instance for agent kube-slave-tq3z1

Jan 10, 2023 7:47:16 PM INFO hudson.slaves.NodeProvisioner update

kube-slave-tq3z1 provisioning successfully completed. We have now 2 computer(s)

To experiment I tried to run this script (inspired by this answer) in the Script Console:

@Grab(group='io.fabric8', module='kubernetes-client', version='6.3.1')
@Grab(group='io.fabric8', module='kubernetes-client-api', version='6.3.1')
@Grab(group='io.fabric8', module='kubernetes-httpclient-jdk', version='6.3.1')

import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;

KubernetesClient client = new KubernetesClientBuilder().build()

Which gives the same error:

io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar

I would prefer not to have to make manual steps to inject jar files into a ready image, so am I missing another Jenkins plugin, or can I have missed something else?

1 Answer 1

3

Upgrade jenkins kubernetes plugin to 3802 and it should work. At least the No httpclient implementations found on the context classloader is addressed by that release.

References:

1
  • hmm that version was not available when i made the post - I see it now
    – JoSSte
    Commented Jan 11, 2023 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.