Hi Team,
We are seeing an issue when we try to configure Jenkins agents as kubernetes pods. When we try to run our pipeline, we are seeing below error and could not able to proceed further.
[Pipeline] Start of Pipeline [Pipeline] libraryResource [Pipeline] podTemplate [Pipeline] // podTemplate [Pipeline] End of Pipeline Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 51f4d6ba-08c3-4f59-b22e-efb466cf6b7a java.lang.NullPointerException: trustManager.acceptedIssuers must not be null at okhttp3.internal.platform.Platform.buildTrustRootIndex(Platform.kt:163) at okhttp3.internal.platform.Platform.buildCertificateChainCleaner(Platform.kt:160) at okhttp3.internal.tls.CertificateChainCleaner$Companion.get(CertificateChainCleaner.kt:42) at okhttp3.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.kt:811) at io.fabric8.kubernetes.client.okhttp.OkHttpClientBuilderImpl.initialBuild(OkHttpClientBuilderImpl.java:68) at io.fabric8.kubernetes.client.okhttp.OkHttpClientBuilderImpl.build(OkHttpClientBuilderImpl.java:55) at io.fabric8.kubernetes.client.okhttp.OkHttpClientBuilderImpl.build(OkHttpClientBuilderImpl.java:36) at io.fabric8.kubernetes.client.KubernetesClientBuilder.getHttpClient(KubernetesClientBuilder.java:92) at io.fabric8.kubernetes.client.KubernetesClientBuilder.build(KubernetesClientBuilder.java:78) at org.csanchez.jenkins.plugins.kubernetes.PodTemplateUtils.parseFromYaml(PodTemplateUtils.java:602) at org.csanchez.jenkins.plugins.kubernetes.PodTemplateUtils.validateYamlContainerNames(PodTemplateUtils.java:639) at org.csanchez.jenkins.plugins.kubernetes.PodTemplateUtils.validateYamlContainerNames(PodTemplateUtils.java:629) at org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.start(PodTemplateStepExecution.java:145)
our podtemplate.groovy is as below:
public void mavenTemplate(body) { podTemplate( yaml: libraryResource('K8s.yaml'), cloud: 'MY-K8Cluster', label: 'jenkins-agent-service' ) { body.call() } } return this
And my corresponding Jenkins file is as below:
@Library('k8sagent') _ import com.PodTemplates my_node="jenkins-agent-service" podTemplates = new PodTemplates() podTemplates.mavenTemplate { node(my_node) { container('k8client') { sh ''' echo K8S_CONTAINER_ENV_VAR = ${CONTAINER_ENV_VAR} ''' } } }
Any suggestion and help is highly appreciated. We are completely blocked.
Note: The connection is successful when we do "TestConnection" from cloud configure settings.
We have enabled the option "Disable https certificate check". Is this causing the issue? Our Jenkins master is not in Kubernetes cluster. If so, could you please guide me on helping the setup?