Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65502

Connection failed because of ~/.kube/config not found

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Not A Defect
    • Component/s: kubernetes-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.277.3
      Kubernetes Plugin 1.29.4
    • Similar Issues:

      Description

      I have re-start tests to integrated OpenShift for Jenkins provisioning.

      I update the service account token (OCP was updated from 4.5 -> 4.7) and click "Test Connection" and got version 1.20.... as expected than I had run some builds.

      After a while I got no more connection with the cluster, so I check the authentication again but now I get this error:

      Error testing connection https://api.acme.com:6443: java.io.FileNotFoundException: /var/lib/jenkins/.kube/config (No such file or directory)
      

      I have try to remove plugin, restart jenkins and reinstall the Kubernetes plugin without luck.
      This is what report Jenkins logs:

      Apr 28, 2021 1:55:37 PM FINE org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncherCreating Pod: kubernetes rad-jenkins/testopenshift-test-150-6fsb2-jh64d-79vx0
      Apr 28, 2021 1:55:37 PM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launchKubernetes returned unhandled HTTP code 0 null
      Apr 28, 2021 1:55:37 PM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launchError in provisioning; agent=KubernetesSlave name: testopenshift-test-150-6fsb2-jh64d-79vx0, template=PodTemplate{id='69a239d7-a813-4165-9c23-702f8d990dad', name='testopenshift_test_150-6fsb2-jh64d', namespace='rad-jenkins', label='testopenshift_test_150-6fsb2', annotations=[PodAnnotation{key='buildUrl', value='http://rad.acme.com:8080/jenkins/job/testopenshift/job/test/150/'}, PodAnnotation{key='runUrl', value='job/testopenshift/job/test/150/'}]}
      java.io.FileNotFoundException: /var/lib/jenkins/.kube/config (No such file or directory)
      	at java.io.FileInputStream.open0(Native Method)
      	at java.io.FileInputStream.open(FileInputStream.java:195)
      	at java.io.FileInputStream.<init>(FileInputStream.java:138)
      	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:354)
      	at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:15)
      	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3413)
      	at io.fabric8.kubernetes.client.internal.KubeConfigUtils.parseConfig(KubeConfigUtils.java:42)
      	at io.fabric8.kubernetes.client.utils.OIDCTokenRefreshInterceptor.intercept(OIDCTokenRefreshInterceptor.java:43)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      	at io.fabric8.kubernetes.client.utils.ImpersonatorInterceptor.intercept(ImpersonatorInterceptor.java:68)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      	at io.fabric8.kubernetes.client.utils.HttpClientUtils.lambda$createHttpClient$3(HttpClientUtils.java:151)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
      	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
      	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
      	at okhttp3.RealCall.execute(RealCall.java:93)
      	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:472)
      	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:435)
      	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:250)
      	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:881)
      	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:341)
      Caused: io.fabric8.kubernetes.client.KubernetesClientException: Operation: [create]  for kind: [Pod]  with name: [null]  in namespace: [rad-jenkins]  failed.
      	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64)
      	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:72)
      	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:349)
      	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:84)
      	at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:136)
      	at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:294)
      	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      I check on jenkins storage and I do not have ~/.kube folder, did you update fabric8 jar that changed some behaviour?

        Attachments

          Activity

          nfalco Nikolas Falco created issue -
          nfalco Nikolas Falco made changes -
          Field Original Value New Value
          Summary No more connections because ~/.kube/config not found Connection failed because of ~/.kube/config not found
          nfalco Nikolas Falco made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Closed [ 6 ]

            People

            Assignee:
            vlatombe Vincent Latombe
            Reporter:
            nfalco Nikolas Falco
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: