-
Bug
-
Resolution: Unresolved
-
Major
-
Jenkinsversion 2.190.1 (not running in Cluster)
Kubernetes Plugin Version 1.20.0 & 1.20.1
Kubernetes Version 1.16.1
Our Jenkins Instance (which is running outside of the Cluster) was configured through the UI to dynamically spawn Slaves inside the Cluster, which was working fine.
Now we wanted configure the PodTemplate as config-as-code in a declarative Pipeline. Using following configuration (as stated in the github description) is working and produces a Pod with 2 Containers (jnlp and maven):
agent { kubernetes { defaultContainer 'jnlp' yaml """ apiVersion: v1 kind: Pod metadata: labels: some-label: some-label-value namespace: jenkins spec: containers: - name: maven image: maven:3.3.9-jdk-8-alpine command: - cat tty: true """ } }
But when we wanted to pull out the Pod config in a seperate file as described in the documentation (https://github.com/jenkinsci/kubernetes-plugin#declarative-pipeline) like so (the file contains the exact same content as above):
agent { kubernetes { defaultContainer 'jnlp' yamlFile 'KubernetesPod.yaml' } }
... it didn't work as expected anymore.
There were created two seperate Pods, each containing a "jenkins/jnlp-slave:alpine" Container, but no maven container at all, which lead to following error in the build log:
java.io.IOException: container [maven] does not exist in pod [testpodfromyml-9-r72hx-m491z-pr022]
Maybe it is important to mention that the Cloud & Podconfiguration in the GUI was still active.