Jenkins agent setup fails

I’m trying to setup an agent per the Add Slave Nodes in Jenkins task. I defined the node for stapp01 in jenkins, then I ssh’d to stapp01 and sudo su - and installed java, downloaded agent.jar, and ran the java command that is visible in Jenkins for the stapp01 node:

java -jar agent.jar -jnlpUrl https://2886795296-8081-kitek06o.environments.katacoda.com/computer/App_server_1/slave-agent.jnlp -secret 2421728a584ac2fe7d7fc93d521a34694afcfa7525a48c89a2942edc0f55876a -workDir "/home/tony/jenkins"

This fails:

May 03, 2021 9:33:15 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/tony/jenkins/remoting as a remoting work directory
May 03, 2021 9:33:15 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/tony/jenkins/remoting
May 03, 2021 9:33:16 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: App_server_1
May 03, 2021 9:33:16 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
May 03, 2021 9:33:16 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.5
May 03, 2021 9:33:16 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/tony/jenkins/remoting as a remoting work directory
May 03, 2021 9:33:16 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [https://2886795296-8081-kitek06o.environments.katacoda.com/]
May 03, 2021 9:33:16 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [Ping]
May 03, 2021 9:33:21 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible
WARNING: connect timed out
May 03, 2021 9:33:21 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: https://2886795296-8081-kitek06o.environments.katacoda.com/ provided port:50000 is not reachable
java.io.IOException: https://2886795296-8081-kitek06o.environments.katacoda.com/ provided port:50000 is not reachable
        at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:314)
        at hudson.remoting.Engine.innerRun(Engine.java:694)
        at hudson.remoting.Engine.run(Engine.java:519)

I checked in Jenkins Configure Global Security and the Agents section shows TCP port for inbound agents: Fixed : 50000 Random Disable

so the port is correct but from the stapp01 if I nc -zv the jenkins host on port 50000 I get no response so I don’t think the port is actually open. I’m not able to ssh to the jenkins host.

What am I missing?

Usually i have seen this when the right java version is not installed in the client.

Try installing the java first and then this should be fine.

@mihsan thanks for suggestion, but wdym by “install Java first”? It is the first thing I installed after I sshd into stapp01. Maybe wrong version, I just did “yum install java”, and IIRC that installed openjdk 1.8. I’ll see if I can find what version of Java is used by Jenkins.

Hi @Schollii

Try to add it as SSH build agent nodes. Let us know if issue still persists.

1 Like

Thanks for reply. That approach worked for me, but I thought maybe direct connection could be made to work in this scenario. OK I will continue on with the SSH approach.