Kubernetes plugin - container is not valid for pod

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Kubernetes plugin - container is not valid for pod

Michael Kanchuker‎
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKdjnp3ZOiEfsLP570txYx6fxOrhi_3AJJBo8gd5z97XFGgOUw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes plugin - container is not valid for pod

vlatombe
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


Le lun. 21 sept. 2020 à 17:19, Michael Kanchuker‎ <[hidden email]> a écrit :
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKdjnp3ZOiEfsLP570txYx6fxOrhi_3AJJBo8gd5z97XFGgOUw%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAH-zGCj57PiTRF47MHXawDZ1yia4ojSiMjNdUP3%2BATixddc2_w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes plugin - container is not valid for pod

Michael Kanchuker‎
Thank you very much, It works now.
I didn't know pod template inheritance was a thing.

Michael.


On Friday, September 25, 2020 at 5:35:49 PM UTC+3 Vincent Latombe wrote:
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


Le lun. 21 sept. 2020 à 17:19, Michael Kanchuker‎ <[hidden email]> a écrit :
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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAKdjnp3ZOiEfsLP570txYx6fxOrhi_3AJJBo8gd5z97XFGgOUw%40mail.gmail.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/313d209e-c96d-441e-aff1-2be8fc59e517n%40googlegroups.com.