Kubernetes plugin - container is not valid for pod

486 views
Skip to first unread message

Michael Kanchuker‎

unread,
Sep 21, 2020, 11:19:28 AM9/21/20
to jenkins...@googlegroups.com
Hi,

Lately I began getting a repeating error in one of my builds: Exec Failure: HTTP:400. Message:container nodejs is not valid for pod admin-builder-d5gwq-ftgs2.
This is a job in a multibranch pipeline running from a Jenkins file (see below). I can see the container in kubectl, and I can run a shell in it.
I don't experience this in my other builds.
I'm running Jenkins v2.249.1 and Kubernetes plugin v1.27.1.

Your help is much appreciated,
Michael Kanchuker.

Jenkinsfile:
podTemplate(label: "admin-builder",
    containers: [
        containerTemplate(name: 'docker', image: 'docker:19.03', ttyEnabled: true, command: 'cat'),
        containerTemplate(name: 'nodejs', image: 'node:12-buster', ttyEnabled: true, command: 'cat')
    ],
    volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]
)
{
    node("admin-builder") {
        stage('Checkout') {
            checkout scm
            container('nodejs') {

Jenkins Log:
Sep 17, 2020 2:56:17 PM SEVERE io.fabric8.kubernetes.client.dsl.internal.ExecWebSocketListener onFailure
Exec Failure: HTTP:400. Message:container nodejs is not valid for pod admin-builder-d5gwq-ftgs2
java.net.ProtocolException: Expected HTTP 101 response but was '400 Bad Request'
	at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:229)
	at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:196)
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203)
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Sep 17, 2020 2:56:17 PM WARNING jenkins.security.ClassFilterImpl notifyRejected
io.fabric8.kubernetes.api.model.Status in file:/var/jenkins_home/plugins/kubernetes-client-api/WEB-INF/lib/kubernetes-model-core-4.11.1.jar might be dangerous, so rejecting; see https://jenkins.io/redirect/class-filter/
Sep 17, 2020 2:56:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
Terminating Kubernetes instance for agent admin-builder-d5gwq-ftgs2
Sep 17, 2020 2:56:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave deleteSlavePod
Terminated Kubernetes instance for agent jenkins/admin-builder-d5gwq-ftgs2
Sep 17, 2020 2:56:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
Disconnected computer admin-builder-d5gwq-ftgs2
Sep 17, 2020 2:56:17 PM INFO jenkins.slaves.DefaultJnlpSlaveReceiver channelClosed
Computer.threadPoolForRemoting [#14] for admin-builder-d5gwq-ftgs2 terminated: java.nio.channels.ClosedChannelException
Sep 17, 2020 2:56:17 PM INFO hudson.remoting.Request$2 run
Failed to send back a reply to the request hudson.remoting.Request$2@21eb663a: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@2c296147:JNLP4-connect connection from 10.42.7.220/10.42.7.220:36320": channel is already closed
Sep 17, 2020 2:56:18 PM INFO org.jenkinsci.plugins.workflow.job.WorkflowRun finish
WB-Services/Admin/jenkins_test #14 completed: FAILURE

Vincent Latombe

unread,
Sep 25, 2020, 10:35:49 AM9/25/20
to Jenkins Users
Try changing your Jenkinsfile to:

podTemplate(
    containers: [
        containerTemplate(name: 'docker', image: 'docker:19.03', ttyEnabled: true, command: 'cat'),
        containerTemplate(name: 'nodejs', image: 'node:12-buster', ttyEnabled: true, command: 'cat')
    ],
    volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]
)
{
    node(POD_LABEL) {

        stage('Checkout') {
            checkout scm
            container('nodejs') {
...


Vincent


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKdjnp3ZOiEfsLP570txYx6fxOrhi_3AJJBo8gd5z97XFGgOUw%40mail.gmail.com.

Michael Kanchuker‎

unread,
Oct 1, 2020, 9:28:30 AM10/1/20
to Jenkins Users
Thank you very much, It works now.
I didn't know pod template inheritance was a thing.

Michael.
Reply all
Reply to author
Forward
0 new messages