Answers: <p>Upgrade jenkins kubernetes plugin to 3802 and it should work. At least the <code>No httpclient implementations found on the context classloader</code> is addressed by that release.</p>
  <p>References:</p>
  <ul>
  <li><a href="https://github.com/jenkinsci/kubernetes-plugin/releases/tag/3802.vb_b_600831fcb_3" rel="nofollow noreferrer">https://github.com/jenkinsci/kubernetes-plugin/releases/tag/3802.vb_b_600831fcb_3</a></li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2023-01-11T14:36:23.213Z
Answers: hmm that version was not available when i made the post - I see it now
Answers: JoSSte
Answers: CC BY-SA 4.0
Answers: 2023-01-11T03:43:51.637Z
Answers: 2023-01-11T03:43:51.637Z
Answers: zerkms
Body: <p>I have installed a k8s cluster (v1.25.4+k3s1) and I have deployed a <a href="https://hub.docker.com/r/jenkins/jenkins" rel="nofollow noreferrer">jenkins image</a> to that cluster (<a href="https://www.jenkins.io/doc/book/installing/kubernetes/" rel="nofollow noreferrer">using this guide</a>) which means that I have the following installed:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Name</th>
  <th>Version</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Jenkins</td>
  <td>v2.375.1</td>
  </tr>
  <tr>
  <td>jvm</td>
  <td>11.0.17+8</td>
  </tr>
  <tr>
  <td><a href="https://plugins.jenkins.io/kubernetes/" rel="nofollow noreferrer">Kubernetes plugin</a></td>
  <td>3743.v1fa_4c724c3b_7</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>When I then try to set up workers on this setup <a href="https://chathura-siriwardhana.medium.com/configure-jenkins-with-kubernetes-e3175e02ca8" rel="nofollow noreferrer">using another guide</a>, I get this error (when starting the job):</p>
  <blockquote>
  <p><code>Jan 10, 2023 7:47:16 PM WARNING org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper watchCloud</code></p>
  <p><code>failed to set up watcher on kubernetes</code><br />
  <code>io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar</code><br />
  <code>  at io.fabric8.kubernetes.client.utils.HttpClientUtils.getHttpClientFactory(HttpClientUtils.java:164)</code><br />
  <code>  at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:145)</code><br />
  <code>  at io.fabric8.kubernetes.client.DefaultKubernetesClient.&lt;init&gt;(DefaultKubernetesClient.java:56)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesFactoryAdapter.createClient(KubernetesFactoryAdapter.java:147)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesClientProvider.createClient(KubernetesClientProvider.java:59)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.connect(KubernetesCloud.java:523)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper.watchCloud(Reaper.java:220)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper.preLaunch(Reaper.java:122)</code><br />
  <code>  at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:296)</code><br />
  <code>  at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:48)</code><br />
  <code>  at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:82)</code><br />
  <code>  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)</code><br />
  <code>  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)</code><br />
  <code>  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)</code><br />
  <code>  at java.base/java.lang.Thread.run(Thread.java:829)</code></p>
  <p><code>Jan 10, 2023 7:47:16 PM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch</code></p>
  <p><code>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'}</code><br />
  <code>io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar</code><br />
  <code>  at io.fabric8.kubernetes.client.utils.HttpClientUtils.getHttpClientFactory(HttpClientUtils.java:164)</code><br />
  <code>  at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:145)</code><br />
  <code>  at io.fabric8.kubernetes.client.DefaultKubernetesClient.&lt;init&gt;(DefaultKubernetesClient.java:56)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesFactoryAdapter.createClient(KubernetesFactoryAdapter.java:147)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesClientProvider.createClient(KubernetesClientProvider.java:59)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud.connect(KubernetesCloud.java:523)</code><br />
  <code>  at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:120)</code><br />
  <code>  at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:298)</code><br />
  <code>  at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:48)</code><br />
  <code>  at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:82)</code><br />
  <code>  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)</code><br />
  <code>  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)</code><br />
  <code>  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)</code><br />
  <code>  at java.base/java.lang.Thread.run(Thread.java:829)</code></p>
  <p><code>Jan 10, 2023 7:47:16 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate</code></p>
  <p><code>Terminating Kubernetes instance for agent kube-slave-tq3z1</code></p>
  <p><code>Jan 10, 2023 7:47:16 PM INFO hudson.slaves.NodeProvisioner update</code></p>
  <p><code>kube-slave-tq3z1 provisioning successfully completed. We have now 2 computer(s)</code></p>
  </blockquote>
  <p>To experiment I tried to run this script (<a href="https://github.com/fabric8io/kubernetes-client/issues/4563#issuecomment-1353163296" rel="nofollow noreferrer">inspired by this answer</a>) in the Script Console:</p>
  <pre class="lang-java prettyprint-override"><code>@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()
  </code></pre>
  <p>Which gives the same error:</p>
  <blockquote>
  <p><code>io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar</code></p>
  </blockquote>
  <p>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?</p>
  
Tags: <kubernetes><jenkins>
Title: Resolving _class not in classpath_ error without doing it manually in a k8s Jenkins instance
UserDisplayName: JoSSte
ThreadText: # Resolving _class not in classpath_ error without doing it manually in a k8s Jenkins instance
  
  (Asked by: username_0 on 2023-01-10)
  
  I have installed a k8s cluster (v1.25.4+k3s1) and I have deployed a [jenkins image](https://hub.docker.com/r/jenkins/jenkins) to that cluster ([using this guide](https://www.jenkins.io/doc/book/installing/kubernetes/)) which means that I have the following installed:
  
  | Name | Version |
  | --- | --- |
  | Jenkins | v2.375.1 |
  | jvm | 11.0.17+8 |
  | [Kubernetes plugin](https://plugins.jenkins.io/kubernetes/) | 3743.v1fa\_4c724c3b\_7 |
  
  When I then try to set up workers on this setup [using another guide](https://chathura-siriwardhana.medium.com/configure-jenkins-with-kubernetes-e3175e02ca8), 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](https://github.com/fabric8io/kubernetes-client/issues/4563#issuecomment-1353163296)) in the Script Console:
  
  ```java
  @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?
  
  **Tags:** kubernetes, jenkins
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-01-11. Score: 3 | Accepted answer
  
  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:
  
  * <https://github.com/jenkinsci/kubernetes-plugin/releases/tag/3802.vb_b_600831fcb_3>
  
  > **Comments:**
  > **username_0**: hmm that version was not available when i made the post - I see it now  
  
  ---
  
  