What Operating System are you using (both controller, and any agents involved in the problem)?
Jenkins is running on Kubernetes inside Linux based containers for both, controller and agents.
Reproduction steps
Configure credential as secret file storing kubeconfig file inside.
Try to do anything inside a withKubeconfig block, for example kubectl get nodes
Expected Results
My expected result was that the output of kubectl command to be listed.
Actual Results
[Pipeline] { (Deploy Helm chart to K8S test)
20220218_08-02-17 [Pipeline] container
20220218_08-02-17 [Pipeline] {
20220218_08-02-18 [Pipeline] script
20220218_08-02-18 [Pipeline] {
20220218_08-02-18 [Pipeline] echo
20220218_08-02-18 dal13_test_k8s_kubeconfig
20220218_08-02-18 [Pipeline] withKubeConfig
20220218_08-02-18 [Pipeline] }
20220218_08-02-19 [Pipeline] // script
20220218_08-02-19 [Pipeline] }
20220218_08-02-19 [Pipeline] // container
20220218_08-02-19 [Pipeline] }
20220218_08-02-19 [Pipeline] // stage
20220218_08-02-20 [Pipeline] }
20220218_08-02-20 [Pipeline] // withEnv
20220218_08-02-20 [Pipeline] }
20220218_08-02-20 [Pipeline] // node
20220218_08-02-21 [Pipeline] }
20220218_08-02-21 [Pipeline] // podTemplate
20220218_08-02-21 [Pipeline] End of Pipeline
20220218_08-02-21 java.lang.ClassNotFoundException: io.fabric8.kubernetes.api.builder.Predicate
20220218_08-02-21 at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1392)
20220218_08-02-21 at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1347)
20220218_08-02-21 at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1093)
20220218_08-02-21 at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
20220218_08-02-21 Caused: java.lang.NoClassDefFoundError: io/fabric8/kubernetes/api/builder/Predicate
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.hasContext(KubeConfigWriter.java:88)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.existingOrNewContext(KubeConfigWriter.java:80)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.setContextNamespace(KubeConfigWriter.java:72)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.completeKubeconfigConfigBuilder(KubeConfigWriter.java:182)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.getConfigBuilder(KubeConfigWriter.java:138)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.writeKubeConfig(KubeConfigWriter.java:119)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.GenericBuildStep.start(GenericBuildStep.java:46)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:319)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
20220218_08-02-21 at sun.reflect.GeneratedMethodAccessor2631.invoke(Unknown Source)
20220218_08-02-21 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
20220218_08-02-21 at java.lang.reflect.Method.invoke(Method.java:498)
20220218_08-02-21 at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
20220218_08-02-21 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
20220218_08-02-21 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
20220218_08-02-21 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
20220218_08-02-21 at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
20220218_08-02-21 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
20220218_08-02-21 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
20220218_08-02-21 at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
20220218_08-02-21 at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
20220218_08-02-21 Caused: java.lang.BootstrapMethodError
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.hasContext(KubeConfigWriter.java:88)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.existingOrNewContext(KubeConfigWriter.java:80)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.setContextNamespace(KubeConfigWriter.java:72)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.completeKubeconfigConfigBuilder(KubeConfigWriter.java:182)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.getConfigBuilder(KubeConfigWriter.java:138)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.kubeconfig.KubeConfigWriter.writeKubeConfig(KubeConfigWriter.java:119)
20220218_08-02-21 at org.jenkinsci.plugins.kubernetes.cli.GenericBuildStep.start(GenericBuildStep.java:46)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:319)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
20220218_08-02-21 at sun.reflect.GeneratedMethodAccessor2631.invoke(Unknown Source)
20220218_08-02-21 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
20220218_08-02-21 at java.lang.reflect.Method.invoke(Method.java:498)
20220218_08-02-21 at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
20220218_08-02-21 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
20220218_08-02-21 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
20220218_08-02-21 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
20220218_08-02-21 at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
20220218_08-02-21 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
20220218_08-02-21 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
20220218_08-02-21 at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
20220218_08-02-21 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
20220218_08-02-21 at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
20220218_08-02-21 at WorkflowScript.run(WorkflowScript:48)
20220218_08-02-21 at ___cps.transform___(Native Method)
20220218_08-02-21 at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
20220218_08-02-21 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
20220218_08-02-21 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
20220218_08-02-21 at sun.reflect.GeneratedMethodAccessor224.invoke(Unknown Source)
20220218_08-02-21 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
20220218_08-02-21 at java.lang.reflect.Method.invoke(Method.java:498)
20220218_08-02-21 at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
20220218_08-02-21 at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
20220218_08-02-21 at com.cloudbees.groovy.cps.Next.step(Next.java:83)
20220218_08-02-21 at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
20220218_08-02-21 at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
20220218_08-02-21 at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
20220218_08-02-21 at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
20220218_08-02-21 at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:402)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:314)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:278)
20220218_08-02-21 at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
20220218_08-02-21 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
20220218_08-02-21 at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
20220218_08-02-21 at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
20220218_08-02-21 at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
20220218_08-02-21 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
20220218_08-02-21 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
20220218_08-02-21 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
20220218_08-02-21 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
20220218_08-02-21 at java.lang.Thread.run(Thread.java:748)
20220218_08-02-21 Finished: FAILURE
Anything else?
I am adding a snippet with the stage which is throwing the above error.
stage('Deploy Helm chart to K8S test') {
steps{
container('helm-deploy') {
script{
KUBECONFIG = 'dal13_test_k8s_kubeconfig'
withKubeConfig([credentialsId: "${KUBECONFIG}", namespace: 'opaas']) {
sh """
kubectl get nodes
"""
}
}
}
}
}
Jenkins and plugins versions report
Environment
```text Jenkins: 2.289.2 OS: Linux - 4.15.0-159-generic --- ace-editor:1.1 ansible:1.1 ansicolor:1.0.0 ant:1.11 antisamy-markup-formatter:2.1 apache-httpcomponents-client-4-api:4.5.13-1.0 artifactory:3.15.4 authentication-tokens:1.4 authorize-project:1.4.0 azure-commons:1.1.3 basic-branch-build-strategies:1.3.2 blueocean-commons:1.25.2 blueocean-core-js:1.25.2 blueocean-github-pipeline:1.24.7 blueocean-jwt:1.24.7 blueocean-pipeline-api-impl:1.24.7 blueocean-pipeline-scm-api:1.24.7 blueocean-rest:1.24.7 blueocean-rest-impl:1.24.7 blueocean-web:1.24.7 bootstrap4-api:4.6.0-3 bootstrap5-api:5.1.3-4 bouncycastle-api:2.25 branch-api:2.7.0 build-keeper-plugin:1.3 build-monitor-plugin:1.13+build.202201221819 build-timestamp:1.0.3 caffeine-api:2.9.2-29.v717aac953ff3 checks-api:1.7.2 cloudbees-disk-usage-simple:0.10 cloudbees-folder:6.17 command-launcher:1.6 conditional-buildstep:1.4.1 config-file-provider:3.8.1 configuration-as-code:1.55.1 content-replace:1.7.0 copy-project-link:1.5 copyartifact:1.46.2 credentials:2.6.1 credentials-binding:1.27.1 cvs:2.17 dark-theme:0.0.12 display-url-api:2.3.5 docker-commons:1.19 docker-java-api:3.1.5.2 docker-plugin:1.2.6 docker-workflow:1.28 durable-task:1.37 echarts-api:5.2.2-2 email-ext:2.87 envfile:1.2 extended-read-permission:3.2 external-monitor-job:1.7 favorite:2.3.2 font-awesome-api:5.15.4-5 ghprb:1.42.2 git:4.10.3 git-client:3.11.0 git-server:1.10 github:1.34.1 github-api:1.301-378.v9807bd746da5 github-branch-source:2.11.4 github-oauth:0.37 github-organization-folder:1.6 github-pr-coverage-status:2.1.1 github-pullrequest:0.4.0 global-slack-notifier:1.5 google-oauth-plugin:1.0.6 gradle:1.36 handlebars:1.1.1 htmlpublisher:1.25 http_request:1.14 icon-shim:2.0.3 ivy:2.1 jackson2-api:2.13.1-246.va8a9f3eaf46a javadoc:1.6 javax-activation-api:1.2.0-2 javax-mail-api:1.6.2-5 jdk-tool:1.4 jenkins-design-language:1.25.2 jjwt-api:0.11.2-7.a257d5ff5a6b job-dsl:1.78.3 jobConfigHistory:2.31-rc1107.2354f08725a_8 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.6.0-2 jsch:0.1.55.2 junit:1.53 kubernetes:1.30.0 kubernetes-cd:2.3.1 kubernetes-cli:1.10.1 kubernetes-client-api:5.4.1 kubernetes-credentials:0.9.0 kubernetes-credentials-provider:0.20 kubernetes-pipeline-devops-steps:1.6 label-linked-jobs:6.0.1 ldap:2.7 lockable-resources:2.14 login-theme:1.1 mailer:408.vd726a_1130320 mapdb-api:1.0.9.0 material-theme:0.4.1 matrix-auth:2.6.7 matrix-project:1.20 maven-plugin:3.16 metrics:4.0.2.8 momentjs:1.1.1 monitoring:1.88.0 next-build-number:1.6 oauth-credentials:0.4 okhttp-api:3.14.9 pam-auth:1.6 parameterized-trigger:2.39 pipeline-build-step:2.15 pipeline-github-lib:1.0 pipeline-graph-analysis:1.11 pipeline-input-step:2.12 pipeline-milestone-step:1.3.2 pipeline-model-api:1.8.5 pipeline-model-definition:1.8.5 pipeline-model-extensions:1.8.5 pipeline-rest-api:2.21 pipeline-stage-step:291.vf0a8a7aeeb50 pipeline-stage-tags-metadata:1.8.5 pipeline-stage-view:2.19 pipeline-utility-steps:2.8.0 plain-credentials:1.7 plugin-util-api:2.13.0 popper-api:1.16.1-2 popper2-api:2.11.2-1 pubsub-light:1.13 purge-build-queue-plugin:1.0 rebuild:1.31 run-condition:1.5 saferestart:0.3 saml:2.0.6 scm-api:595.vd5a_df5eb_0e39 script-security:1131.v8b_b_5eda_c328e semantic-versioning-plugin:1.13 sidebar-link:1.12.0 simple-theme-plugin:0.6 slack:2.47 snakeyaml-api:1.29.1 ssh:2.6.1 ssh-agent:1.23 ssh-credentials:1.19 ssh-slaves:1.31.5 sshd:3.0.4 structs:308.v852b473a2b8c subversion:2.14.0 theme-manager:0.6 thinBackup:1.10 timestamper:1.12 token-macro:270.v8c2ce50dc4fc translation:1.16 trilead-api:1.0.13 uno-choice:2.5.7 variant:1.4 view-job-filters:2.3 windows-slaves:1.7 workflow-aggregator:2.6 workflow-api:1136.v7f5f1759dc16 workflow-basic-steps:2.23 workflow-cps:2648.va9433432b33c workflow-cps-global-lib:2.20 workflow-durable-task-step:2.40 workflow-job:1145.v7f2433caa07f workflow-multibranch:706.vd43c65dec013 workflow-scm-step:2.13 workflow-step-api:622.vb_8e7c15b_c95a_ workflow-support:3.8 ```What Operating System are you using (both controller, and any agents involved in the problem)?
Jenkins is running on Kubernetes inside Linux based containers for both, controller and agents.
Reproduction steps
kubectl get nodes
Expected Results
My expected result was that the output of kubectl command to be listed.
Actual Results
Anything else?
I am adding a snippet with the stage which is throwing the above error.