Kubernetes-Plugin BadRequest container name must be specified

1,959 views
Skip to first unread message

Chris Denneen

unread,
Jan 22, 2018, 3:01:41 PM1/22/18
to jenkins...@googlegroups.com
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?

Carlos Sanchez

unread,
Jan 22, 2018, 3:56:46 PM1/22/18
to jenkins...@googlegroups.com

Yes you are missing the container name at the end

kubectl logs jenkins-slave-1kl4v-flv53 golang


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

Chris Denneen

unread,
Jan 22, 2018, 4:32:02 PM1/22/18
to Jenkins Users
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

Chris Denneen

unread,
Jan 22, 2018, 5:27:20 PM1/22/18
to Jenkins Users
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

Carlos Sanchez

unread,
Jan 31, 2018, 3:18:43 AM1/31/18
to Jenkins Users
On Mon, Jan 22, 2018 at 11:27 PM, Chris Denneen <cden...@gmail.com> 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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/01214aa2-964c-4819-99e8-75e8c712b9b1%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages