title: Kubernetes plugin containers can't connect back to Jenkins
body: <p>I have a Jenkins and Kubernetes cluster running within the same network in AWS. Jenkins has it's own instance.</p>
  
  <p>I have configured the Kubernetes plugin as follows:
  <a href="https://i.stack.imgur.com/4gUkH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4gUkH.jpg" alt="enter image description here"></a></p>
  
  <p>The recommended JNLP docker image is used. Jenkins JNLP port is configured to be static <code>5000</code>.</p>
  
  <p>Now when I kick off the job, it shows me that the node is offline. When I click on the offline node I get this: </p>
  
  <p><a href="https://i.stack.imgur.com/nuRLf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nuRLf.png" alt="enter image description here"></a></p>
  
  <p>This makes me go to the k8 cluster. Running <code>docker ps</code> shows no containers running. However:</p>
  
  <p><a href="https://i.stack.imgur.com/RN2wO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RN2wO.png" alt="enter image description here"></a></p>
  
  <p>From there I go to find what docker container gets run and what logs it leaves after that: </p>
  
  <p><a href="https://i.stack.imgur.com/8TDm8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8TDm8.png" alt="enter image description here"></a></p>
  
  <p>I use: 
  <a href="https://github.com/jenkinsci/docker-jnlp-slave" rel="nofollow noreferrer">https://github.com/jenkinsci/docker-jnlp-slave</a> as image</p>
  
  <p><a href="https://github.com/jenkinsci/kubernetes-plugin" rel="nofollow noreferrer">https://github.com/jenkinsci/kubernetes-plugin</a></p>
  
  <p>Jenkins version: <code>2.27</code></p>
  
  <p>k8: <code>hyperkube:v1.4.3_coreos.0</code></p>
  
  <p>Jenkins does spin up the container, I guess it runs and errors out because no valid arguments are provided during the container run? I need it to be a hands off process where I don't have to log in to my containers (Java clients). How do I achieve this? </p>
  
  <p><strong><em>UPDATE</em></strong></p>
  
  <p>Based on this answer: <a href="https://stackoverflow.com/questions/40533983/kubernetes-slaves-cannot-register-to-jenkins-master">kubernetes slaves cannot register to jenkins master</a></p>
  
  <p>If I log into the container and run the command that Jenkins displays under the host that cannot connect: </p>
  
  <p><code>java -jar /usr/share/jenkins/slave.jar -jnlpUrl https://test.myhost.com/computer/jenkinsminions-10f0b7d49054ac/slave-agent.jnlp -secret 62637e83008f50eb94483ad609e9a2719d313fa56e640e4beca9eebeaf0b1af2</code></p>
  
  <p>The container connects via JNLP2 and the job runs. </p>
  
  <p>I tried to add the arguments as suggested, but no luck. Containers still won't connect automatically: <a href="https://i.stack.imgur.com/QL4sZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QL4sZ.png" alt="enter image description here"></a></p>