Answers: <p>docker inspect the container running jenkins</p>
  
  <pre><code>docker inspect  eaddfb02c83c|grep _50000
  </code></pre>
  
  <p>this gives some variables which are set with the correct address</p>
  
  <pre><code>$ docker inspect  eaddfb02c83c|grep _50000
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP_PORT=50000",
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP_ADDR=10.102.9.168",
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP_PROTO=tcp",
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP=tcp://10.102.9.168:50000",
  </code></pre>
  
  <p>use this information to set the "Jenkins tunnel" argument in the Cloud Kubernetes, using the values above for example the setting is 10.102.9.168:50000</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-07T10:22:31.280Z
Answers: 2019-02-07T10:22:31.280Z
Answers: Vorsprung
Body: <p>I am trying to run a jenkins system on my macbook for testing</p>
  
  <p>Jenkins is running in the mac "Docker Desktop" in Kubernetes, using a helm chart</p>
  
  <p>It has a Kubernetes slave set up with the Kubernetes plugin</p>
  
  <p>When I start a job, a new Kubernetes pod is started.  But it is unable to fully attach to Jenkins and so run the job</p>
  
  <p>Here's some logs from the docker container running the Jenkins master</p>
  
  <p>As you can see, it seems to work fine until the "tunnel" is used</p>
  
  <p>Any ideas what to set the tunnel to?  I've tried leaving it blank, setting to the IP of the Jenkins Kubernetes instance or setting it to localhost.  None of these work</p>
  
  <p>Is this perhaps a networking problem with Kubernetes or Docker?</p>
  
  <pre><code>docker logs -f f8ad22879548
  INFO: Container is waiting kubernetes-slave-nvfvb [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={})
  Feb 06, 2019 3:50:00 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for Pod to be scheduled (1/200): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:01 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Container is waiting kubernetes-slave-nvfvb [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={})
  Feb 06, 2019 3:50:01 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for Pod to be scheduled (2/200): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:02 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Container is waiting kubernetes-slave-nvfvb [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={})
  Feb 06, 2019 3:50:02 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for Pod to be scheduled (3/200): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:03 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for agent to connect (0/100): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:04 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for agent to connect (1/100): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:05 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  ...etc etc..
  INFO: Waiting for agent to connect (99/100): kubernetes-slave-nvfvb
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher logLastLines
  SEVERE: Error in provisioning; agent=KubernetesSlave name: kubernetes-slave-nvfvb, template=PodTemplate{inheritFrom='', name='kubernetes-slave', namespace='', instanceCap=2, idleMinutes=2, label='utils', nodeSelector='utils', nodeUsageMode=NORMAL, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[HostPathVolume [mountPath=/var/run/docker.sock, hostPath=/var/run/docker.sock]], containers=[ContainerTemplate{name='jnlp', image='adriagalin/jenkins-jnlp-slave:1.4', workingDir='/home/jenkins', command='', args='${computer.jnlpmac} ${computer.name}', resourceRequestCpu='200m', resourceRequestMemory='256Mi', resourceLimitCpu='200m', resourceLimitMemory='256Mi', livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@56ff8e15}], yaml=}. Container jnlp. Logs: INFO: Jenkins agent is running in headless mode.
  Feb 06, 2019 3:50:07 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Locating server among [http://10.74.121.25:8080/]
  Feb 06, 2019 3:50:08 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
  INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
  Feb 06, 2019 3:50:08 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Agent discovery successful
    Agent address: 10.74.121.25
    Agent port:    50000
    Identity:      cd:a5:60:45:4d:45:7c:53:83:48:5b:d3:d5:02:68:4f
  Feb 06, 2019 3:50:08 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Handshaking
  Feb 06, 2019 3:50:08 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to 10.74.121.25:50000
  Feb 06, 2019 3:51:34 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to 10.74.121.25:50000 (retrying:2)
  java.io.IOException: Failed to connect to 10.74.121.25:50000
          at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:243)
          at hudson.remoting.Engine.connect(Engine.java:500)
          at hudson.remoting.Engine.innerRun(Engine.java:364)
          at hudson.remoting.Engine.run(Engine.java:287)
  Caused by: java.net.ConnectException: Connection refused
          at sun.nio.ch.Net.connect0(Native Method)
          at sun.nio.ch.Net.connect(Net.java:454)
          at sun.nio.ch.Net.connect(Net.java:446)
          at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
          at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
          at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:204)
          ... 3 more
  
  
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  WARNING: Error in provisioning; agent=KubernetesSlave name: kubernetes-slave-nvfvb, template=PodTemplate{inheritFrom='', name='kubernetes-slave', namespace='', instanceCap=2, idleMinutes=2, label='utils', nodeSelector='utils', nodeUsageMode=NORMAL, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[HostPathVolume [mountPath=/var/run/docker.sock, hostPath=/var/run/docker.sock]], containers=[ContainerTemplate{name='jnlp', image='adriagalin/jenkins-jnlp-slave:1.4', workingDir='/home/jenkins', command='', args='${computer.jnlpmac} ${computer.name}', resourceRequestCpu='200m', resourceRequestMemory='256Mi', resourceLimitCpu='200m', resourceLimitMemory='256Mi', livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@56ff8e15}], yaml=}
  java.lang.IllegalStateException: Agent is not connected after 100 seconds, status: Running
          at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:224)
          at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:294)
          at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
          at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          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)
  
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
  INFO: Terminating Kubernetes instance for agent kubernetes-slave-nvfvb
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave deleteSlavePod
  </code></pre>
  
Tags: <jenkins><kubernetes>
Title: What setting to use for jenkins tunnel?
UserDisplayName: Vorsprung
ThreadText: # What setting to use for jenkins tunnel?
  
  (Asked by: username_0 on 2019-02-06)
  
  I am trying to run a jenkins system on my macbook for testing
  
  Jenkins is running in the mac "Docker Desktop" in Kubernetes, using a helm chart
  
  It has a Kubernetes slave set up with the Kubernetes plugin
  
  When I start a job, a new Kubernetes pod is started. But it is unable to fully attach to Jenkins and so run the job
  
  Here's some logs from the docker container running the Jenkins master
  
  As you can see, it seems to work fine until the "tunnel" is used
  
  Any ideas what to set the tunnel to? I've tried leaving it blank, setting to the IP of the Jenkins Kubernetes instance or setting it to localhost. None of these work
  
  Is this perhaps a networking problem with Kubernetes or Docker?
  
  ```
  docker logs -f f8ad22879548
  INFO: Container is waiting kubernetes-slave-nvfvb [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={})
  Feb 06, 2019 3:50:00 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for Pod to be scheduled (1/200): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:01 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Container is waiting kubernetes-slave-nvfvb [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={})
  Feb 06, 2019 3:50:01 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for Pod to be scheduled (2/200): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:02 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Container is waiting kubernetes-slave-nvfvb [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={})
  Feb 06, 2019 3:50:02 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for Pod to be scheduled (3/200): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:03 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for agent to connect (0/100): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:04 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  INFO: Waiting for agent to connect (1/100): kubernetes-slave-nvfvb
  Feb 06, 2019 3:50:05 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  ...etc etc..
  INFO: Waiting for agent to connect (99/100): kubernetes-slave-nvfvb
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher logLastLines
  SEVERE: Error in provisioning; agent=KubernetesSlave name: kubernetes-slave-nvfvb, template=PodTemplate{inheritFrom='', name='kubernetes-slave', namespace='', instanceCap=2, idleMinutes=2, label='utils', nodeSelector='utils', nodeUsageMode=NORMAL, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[HostPathVolume [mountPath=/var/run/docker.sock, hostPath=/var/run/docker.sock]], containers=[ContainerTemplate{name='jnlp', image='adriagalin/jenkins-jnlp-slave:1.4', workingDir='/home/jenkins', command='', args='${computer.jnlpmac} ${computer.name}', resourceRequestCpu='200m', resourceRequestMemory='256Mi', resourceLimitCpu='200m', resourceLimitMemory='256Mi', livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@56ff8e15}], yaml=}. Container jnlp. Logs: INFO: Jenkins agent is running in headless mode.
  Feb 06, 2019 3:50:07 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Locating server among [http://10.74.121.25:8080/]
  Feb 06, 2019 3:50:08 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
  INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
  Feb 06, 2019 3:50:08 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Agent discovery successful
    Agent address: 10.74.121.25
    Agent port:    50000
    Identity:      cd:a5:60:45:4d:45:7c:53:83:48:5b:d3:d5:02:68:4f
  Feb 06, 2019 3:50:08 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Handshaking
  Feb 06, 2019 3:50:08 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to 10.74.121.25:50000
  Feb 06, 2019 3:51:34 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to 10.74.121.25:50000 (retrying:2)
  java.io.IOException: Failed to connect to 10.74.121.25:50000
          at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:243)
          at hudson.remoting.Engine.connect(Engine.java:500)
          at hudson.remoting.Engine.innerRun(Engine.java:364)
          at hudson.remoting.Engine.run(Engine.java:287)
  Caused by: java.net.ConnectException: Connection refused
          at sun.nio.ch.Net.connect0(Native Method)
          at sun.nio.ch.Net.connect(Net.java:454)
          at sun.nio.ch.Net.connect(Net.java:446)
          at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
          at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
          at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:204)
          ... 3 more
  
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
  WARNING: Error in provisioning; agent=KubernetesSlave name: kubernetes-slave-nvfvb, template=PodTemplate{inheritFrom='', name='kubernetes-slave', namespace='', instanceCap=2, idleMinutes=2, label='utils', nodeSelector='utils', nodeUsageMode=NORMAL, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[HostPathVolume [mountPath=/var/run/docker.sock, hostPath=/var/run/docker.sock]], containers=[ContainerTemplate{name='jnlp', image='adriagalin/jenkins-jnlp-slave:1.4', workingDir='/home/jenkins', command='', args='${computer.jnlpmac} ${computer.name}', resourceRequestCpu='200m', resourceRequestMemory='256Mi', resourceLimitCpu='200m', resourceLimitMemory='256Mi', livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@56ff8e15}], yaml=}
  java.lang.IllegalStateException: Agent is not connected after 100 seconds, status: Running
          at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:224)
          at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:294)
          at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
          at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          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)
  
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
  INFO: Terminating Kubernetes instance for agent kubernetes-slave-nvfvb
  Feb 06, 2019 3:51:46 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave deleteSlavePod
  
  ```
  
  **Tags:** jenkins, kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-02-07. Score: 1 | Accepted answer
  
  docker inspect the container running jenkins
  
  ```
  docker inspect  eaddfb02c83c|grep _50000
  
  ```
  
  this gives some variables which are set with the correct address
  
  ```
  $ docker inspect  eaddfb02c83c|grep _50000
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP_PORT=50000",
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP_ADDR=10.102.9.168",
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP_PROTO=tcp",
              "MY_RELEASE_JENKINS_AGENT_PORT_50000_TCP=tcp://10.102.9.168:50000",
  
  ```
  
  use this information to set the "Jenkins tunnel" argument in the Cloud Kubernetes, using the values above for example the setting is 10.102.9.168:50000
  
  
  ---
  
  