jenkins-x / jx

Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
https://jenkins-x.io/
Apache License 2.0
4.57k stars 787 forks source link

Jenkins slave unable to connect to Jenkins master #1693

Closed krishshenoy closed 5 years ago

krishshenoy commented 6 years ago

Summary

Steps to reproduce the behavior

  1. Successfully deployed jenkins-x on my VKE kubernetes deployment.
  2. Tried to create a jenkins project using jx command line jx create quickstart -l go
  3. The project gets created and the pod that runs the jenkins slave gets created. however the jenkins slave is unable to connect to the jenkins master.
  4. I see the following error in the JNLP container for jenkins slave. docker logs k8s_jnlp_go-zl4r3_jx_667f2a86-b847-11e8-a2f7-065f09830b92_0 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 Sep 14, 2018 5:57:23 PM hudson.remoting.jnlp.Main createEngine INFO: Setting up slave: go-zl4r3 Sep 14, 2018 5:57:23 PM hudson.remoting.jnlp.Main$CuiListener INFO: Jenkins agent is running in headless mode. Sep 14, 2018 5:57:23 PM hudson.remoting.Engine startEngine WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars Sep 14, 2018 5:57:23 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Locating server among [http://jenkins:8080] Sep 14, 2018 5:57:43 PM hudson.remoting.jnlp.Main$CuiListener error SEVERE: Failed to connect to http://jenkins:8080/tcpSlaveAgentListener/: jenkins java.io.IOException: Failed to connect to http://jenkins:8080/tcpSlaveAgentListener/: jenkins at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:168) at hudson.remoting.Engine.innerRun(Engine.java:503) at hudson.remoting.Engine.run(Engine.java:455) Caused by: java.net.UnknownHostException: jenkins at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) at sun.net.www.http.HttpClient.(HttpClient.java:242) at sun.net.www.http.HttpClient.New(HttpClient.java:339) at sun.net.www.http.HttpClient.New(HttpClient.java:357) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:165)

Somehow the jenkins slave is not receiving the jenkins URL for the master. Where do I configure the jenkins master URL for the jenkins slave?

Jx version

The output of jx version is: NAME VERSION jx 1.3.243 jenkins x platform 0.0.2328 kubernetes cluster v1.10.2 kubectl v1.10.2 helm client v2.10.0+g9ad53aa helm server v2.10.0+g9ad53aa git git version 2.14.3 (Apple Git-98)

Kubernetes cluster

kubernetes cluster deployed on Vmware kubernetes engine What kind of Kubernetes cluster are you using & how did you create it?

Operating system / Environment

Linux

Expected behavior

Jenkins slave pod connecting to the jenkins master

Actual behavior

JNLP container cannot connect to jenkins master and then gets terminated after a few minutes

krishshenoy commented 5 years ago

I did not hit this issue after I deleted all files in ~/.jx and reinstalled Jenkins-X using JX