Kubernetes-Plugin BadRequest container name must be specified

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

Kubernetes-Plugin BadRequest container name must be specified

Chris Denneen
I've installed latest LTS of jenkins and installed latest kubernetes-plugin.

I've created 2 pipeline jobs to test:


Both pods create with the following logs and loop:

work/capdev-kubernetes » kubectl logs jenkins-slave-1kl4v-flv53
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-1kl4v-flv53, choose one of: [golang jnlp]

work/capdev-kubernetes » kubectl logs jenkins-slave-pwcwz-2k20s
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-pwcwz-2k20s, choose one of: [maven golang jnlp]


Is there something else that needs to be done in order to get these to work?

--
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/CAP0Su%2BKLQCYLtMb21%3DvKzRJAfUPZnMkncGpmp9D1zoB%2BAeh9qA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes-Plugin BadRequest container name must be specified

Carlos Sanchez

Yes you are missing the container name at the end

kubectl logs jenkins-slave-1kl4v-flv53 golang


On Mon, Jan 22, 2018, 21:01 Chris Denneen <[hidden email]> wrote:
I've installed latest LTS of jenkins and installed latest kubernetes-plugin.

I've created 2 pipeline jobs to test:


Both pods create with the following logs and loop:

work/capdev-kubernetes » kubectl logs jenkins-slave-1kl4v-flv53
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-1kl4v-flv53, choose one of: [golang jnlp]

work/capdev-kubernetes » kubectl logs jenkins-slave-pwcwz-2k20s
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-pwcwz-2k20s, choose one of: [maven golang jnlp]


Is there something else that needs to be done in order to get these to work?

--
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/CAP0Su%2BKLQCYLtMb21%3DvKzRJAfUPZnMkncGpmp9D1zoB%2BAeh9qA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CALHFn6PsL4j_GkSXD%3D_6QZHLhogiv3MC4koRkggf8P9%3D3Hee7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes-Plugin BadRequest container name must be specified

Chris Denneen
jnlp:
Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior
Warning: SECRET is defined twice in command-line arguments and the environment variable
Warning: AGENT_NAME is defined twice in command-line arguments and the environment variable
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: golang-d4xmn-qk7g5
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jan 22, 2018 9:27:05 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [https://jenkins.k8s.example.com/]
Jan 22, 2018 9:27:05 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: jenkins.k8s.example.com
  Agent port:    50000
  Identity:      67:79:2e:b1:ec:6e:88:d4:d3:36:0a:8a:60:62:3c:40
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins.k8s.example.com:50000
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Protocol JNLP4-connect encountered an unexpected exception
java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)
at hudson.remoting.Engine.innerRun(Engine.java:609)
at hudson.remoting.Engine.run(Engine.java:469)
Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecvClosed(AckFilterLayer.java:280)
at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:832)
at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$1500(BIONetworkLayer.java:48)
at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader.run(BIONetworkLayer.java:247)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at hudson.remoting.Engine$1$1.run(Engine.java:94)
at java.lang.Thread.run(Thread.java:748)

Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins.k8s.example.com:50000
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Server reports protocol JNLP4-plaintext not supported, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Protocol JNLP3-connect is not enabled, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Server reports protocol JNLP2-connect not supported, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Server reports protocol JNLP-connect not supported, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: The server rejected the connection: None of the protocols were accepted
java.lang.Exception: The server rejected the connection: None of the protocols were accepted
at hudson.remoting.Engine.onConnectionRejected(Engine.java:670)
at hudson.remoting.Engine.innerRun(Engine.java:634)
at hudson.remoting.Engine.run(Engine.java:469)

work/capdev-kubernetes » kubectl logs golang-d4xmn-qk7g5 golang
failed to get container status {"docker" "88c88f113b96b5424389981e06e4b4336c442b34d5cff14fffb8f005cbce9058"}: rpc error: code = Unknown desc = Error: No such container: 88c88f113b96b542438998work/capdev-kubernetes » kubectl logs golang-d4xmn-qk7g5 golang
failed to get container status {"docker" "88c88f113b96b5424389981e06e4b4336c442b34d5cff14fffb8f005cbce9058"}: rpc error: code = Unknown desc = Error: No such container: 88c88f113b96b542438998work/capdev-kubernetes » kubectl logs golang-d4xmn-qk7g5 golang
failed to get container status {"docker" "88c88f113b96b5424389981e06e4b4336c442b34d5cff14fffb8f005cbce9058"}: rpc error: code = Unknown desc = Error: No such container: 88c88f113b96b542438998work/capdev-kubernetes » kubectl logs golang-d4xmn-qk7g5 golang
failed to get container status {"docker" "88c88f113b96b5424389981e06e4b4336c442b34d5cff14fffb8f005cbce9058"}: rpc error: code = Unknown desc = Error: No such container: 88c88f113b96b542438998work/capdev-kubernetes » kubectl logs golang-d4xmn-qk7g5 jnlp
Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior
Warning: SECRET is defined twice in command-line arguments and the environment variable
Warning: AGENT_NAME is defined twice in command-line arguments and the environment variable
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: golang-d4xmn-qk7g5
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jan 22, 2018 9:27:05 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [https://jenkins.k8s.example.com/]
Jan 22, 2018 9:27:05 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: jenkins.k8s.example.com
  Agent port:    50000
  Identity:      67:79:2e:b1:ec:6e:88:d4:d3:36:0a:8a:60:62:3c:40
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins.k8s.example.com:50000
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Protocol JNLP4-connect encountered an unexpected exception
java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)
at hudson.remoting.Engine.innerRun(Engine.java:609)
at hudson.remoting.Engine.run(Engine.java:469)
Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecvClosed(AckFilterLayer.java:280)
at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:832)
at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$1500(BIONetworkLayer.java:48)
at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader.run(BIONetworkLayer.java:247)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at hudson.remoting.Engine$1$1.run(Engine.java:94)
at java.lang.Thread.run(Thread.java:748)

Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins.k8s.example.com:50000
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Server reports protocol JNLP4-plaintext not supported, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Protocol JNLP3-connect is not enabled, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Server reports protocol JNLP2-connect not supported, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Server reports protocol JNLP-connect not supported, skipping
Jan 22, 2018 9:27:05 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: The server rejected the connection: None of the protocols were accepted
java.lang.Exception: The server rejected the connection: None of the protocols were accepted
at hudson.remoting.Engine.onConnectionRejected(Engine.java:670)
at hudson.remoting.Engine.innerRun(Engine.java:634)
at hudson.remoting.Engine.run(Engine.java:469)



golang:
failed to get container status {"docker" "88c88f113b96b5424389981e06e4b4336c442b34d5cff14fffb8f005cbce9058"}: rpc error: code = Unknown desc = Error: No such container: 88c88f113b96b542438998

--
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/317694de-70b2-4864-a9d5-ac07f7ea4c75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes-Plugin BadRequest container name must be specified

Chris Denneen
In reply to this post by Chris Denneen
1. I was using the external name rather than the internal (cluster.local) DNS name in the Kubernetes Cloud Configuration in Jenkins
2. Even when I switched it appears it's because the port is necessary (http://jenkins.jenkins.svc.cluster.local:443) which I found in open issue (https://issues.jenkins-ci.org/browse/JENKINS-48368) 
3. If Jenkins wasn't running within a Kubernetes cluster but you wanted to leverage the slaves/agents to be run on one then I'm guessing a slave secret would need to be made available.

Can documentation for #2 and #3 be made/updated for future?

Thanks

On Monday, January 22, 2018 at 3:01:41 PM UTC-5, Chris Denneen wrote:
I've installed latest LTS of jenkins and installed latest kubernetes-plugin.

I've created 2 pipeline jobs to test:

pod-golang from here (<a href="https://kumorilabs.com/blog/k8s-6-integrating-jenkins-kubernetes/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fkumorilabs.com%2Fblog%2Fk8s-6-integrating-jenkins-kubernetes%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFy2eFW2JVUiMddNYYAwcMWodo4MQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fkumorilabs.com%2Fblog%2Fk8s-6-integrating-jenkins-kubernetes%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFy2eFW2JVUiMddNYYAwcMWodo4MQ&#39;;return true;">https://kumorilabs.com/blog/k8s-6-integrating-jenkins-kubernetes/) 
and one from Carlos Sanchez blog here (<a href="https://blog.csanchez.org/2016/10/25/jenkins-kubernetes-plugin-0-9-released/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fblog.csanchez.org%2F2016%2F10%2F25%2Fjenkins-kubernetes-plugin-0-9-released%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHBG9xfrP2SLSxeCMHI5RFvkb1Dtg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fblog.csanchez.org%2F2016%2F10%2F25%2Fjenkins-kubernetes-plugin-0-9-released%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHBG9xfrP2SLSxeCMHI5RFvkb1Dtg&#39;;return true;">https://blog.csanchez.org/2016/10/25/jenkins-kubernetes-plugin-0-9-released/)

Both pods create with the following logs and loop:

work/capdev-kubernetes » kubectl logs jenkins-slave-1kl4v-flv53
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-1kl4v-flv53, choose one of: [golang jnlp]

work/capdev-kubernetes » kubectl logs jenkins-slave-pwcwz-2k20s
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-pwcwz-2k20s, choose one of: [maven golang jnlp]


Is there something else that needs to be done in order to get these to work?

--
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/01214aa2-964c-4819-99e8-75e8c712b9b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Kubernetes-Plugin BadRequest container name must be specified

Carlos Sanchez


On Mon, Jan 22, 2018 at 11:27 PM, Chris Denneen <[hidden email]> wrote:
1. I was using the external name rather than the internal (cluster.local) DNS name in the Kubernetes Cloud Configuration in Jenkins
2. Even when I switched it appears it's because the port is necessary (http://jenkins.jenkins.svc.cluster.local:443) which I found in open issue (https://issues.jenkins-ci.org/browse/JENKINS-48368

The port depends on how you expose the jenkins service. You setup the jenkins service as non ssl in port 443 ? that's wrong
 
3. If Jenkins wasn't running within a Kubernetes cluster but you wanted to leverage the slaves/agents to be run on one then I'm guessing a slave secret would need to be made available.

That depends on how you want to set it up, there are many options and different authentication providers
 

Can documentation for #2 and #3 be made/updated for future?

Thanks

On Monday, January 22, 2018 at 3:01:41 PM UTC-5, Chris Denneen wrote:
I've installed latest LTS of jenkins and installed latest kubernetes-plugin.

I've created 2 pipeline jobs to test:


Both pods create with the following logs and loop:

work/capdev-kubernetes » kubectl logs jenkins-slave-1kl4v-flv53
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-1kl4v-flv53, choose one of: [golang jnlp]

work/capdev-kubernetes » kubectl logs jenkins-slave-pwcwz-2k20s
Error from server (BadRequest): a container name must be specified for pod jenkins-slave-pwcwz-2k20s, choose one of: [maven golang jnlp]


Is there something else that needs to be done in order to get these to work?

--
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/01214aa2-964c-4819-99e8-75e8c712b9b1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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/CALHFn6NUQPKrVRkcVDducgRAc-f6-r9h7Q2YVJfuGQTKP5J7Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.