Jenkins slave configuration issue - jenkins

Have been trying for hours for setting up master-slave configuration in jenkins and getting this error when triggering the jnlp file from slave machine: "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".. Everything seems set correctly from my end - Java 1.8.181 in both master and slave machines, jenkins 2.147 in both machines.
Here is the entire log: https://gist.github.com/anuraagkb/13f4f226a411fe02596af66be877257d

My bad..for the Jenkins URL under Manage Jenkins-> Configure System I had entered localhost instead of the server IP which caused the issue.

Related

Jenkins slave pod on kubernetes randomly failing

I have set a Jenkins master (on a VM) and this is provisioning jnlp slaves as kubernetes pods.
In very rare occasions, the pipeline fails, with this message:
java.io.IOException: Pipe closed
at java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:260)
at java.io.PipedInputStream.receive(PipedInputStream.java:226)
at java.io.PipedOutputStream.write(PipedOutputStream.java:149)
at java.io.OutputStream.write(OutputStream.java:75)
at org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1.setupEnvironmentVariable(ContainerExecDecorator.java:510)
at org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1.doLaunch(ContainerExecDecorator.java:474)
at org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator$1.launch(ContainerExecDecorator.java:333)
at hudson.Launcher$ProcStarter.start(Launcher.java:455)
Viewing kubernetes logs Stackdriver in Stackdriver, one can see that the pod does manage to connect to the master, e.g.
Handshaking
Agent discovery successful
Trying protocol: JNLP4-Connect
Remote Identity confirmed: <some_hash_here>
Connecting to <jenkins-master-url>:49187
started container
loading plugin ...
but after a while it fails and here are the relevant logs:
org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave$SlaveDisconnector call
INFO: Disabled slave engine reconnects.
hudson.remoting.jnlp.Main$CuiListener status
Terminated
hudson.remoting.Request$2 run
Failed to send back a reply to the request hudson.remoting.Request$2#336ec321: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel#29d0e8b2:JNLP4-connect connection to <jenkins-master-url>/<public-ip-of-jenkins-master>:49187": channel is already closed
"Processing signal 'terminated'"
.
.
.
How can I further troubleshoot this random error?
Can you take a look at the Kubernetes Pod-Events with Stackdriver? We had a similar behavior with a different CI-System (GitlabCI). Our builds where also randomly failing. It turned out that the JVM inside the Container exceeded its memory limitation and was killed by Kubernetes (OOMKilled) and the CI-System recognised this as a build error.

Why can't I set up a jenkins agent on the same machine as the master (WIndows 10), Jenkins on localhost?

Can't set up an agent on the same machine as the master node in Jenkins. The Jenkins instance is on localhost as is the agent. The main problem I'm getting is:
at
yah de yah.....
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: http://192.168.0.1:8080/
Here's what I tried:
1 - Configure agent launched via ssh, Host is http://192.168.0.1:8080/ (also tried 127.0.0.1 and localhost here but the URL in Jenkins config is as shown) with Jenkins admin password. Used 'Known host file Verification Strategy' Advanced setting uses port 22. Tried Jenkins Global Security settings with fixed port 22, 50000 and random port setting.
Also toggled Windows OpenSSH for client and server with the above combinations.
Configure agent by Connecting it to the master; other options as default. Got 'Agent is offline because Jenkins failed to launch the agent process' and got the 'Launch' button for webstart. Clicked on that; nothing happened (that I saw) but the file did appear in my downloads folder.
Copied the file to another directory, opened a command window in that directory and entered the 'headless' command shown in the window with the webstart button. Got:
Error: Unable to access jarfile agent.jar
Seems no matter what I try I can't connect to http://192.168.0.1:8080/
Is this some sort of tunneling issue where I need to expose localhost even though I'm not going over the Internet? I needed to do that to get my localhost Jenkins install to talk to GitHub.
Been reading numerous articles,watched videos - seems most of the material out there is for a 'real' use of creating agents on separate machines.
Any advice would be MOST appreciated.

tcpSlaveAgentListener not found on Jenkins server

I am trying to connect to a Jenkins master instance from a slave. From a connectivity standpoint, everything looks good. I am able to curl the selected "TCP port for JNLP agent" as set in "Configure Global Security" in Jenkins from where I am starting the slave node:
$ curl http://myjenkinsurl:7004/
Jenkins-Agent-Protocols: CLI-connect, CLI2-connect, JNLP-connect,
JNLP2-connect, JNLP4-connect, Ping
Jenkins-Version: 2.62
Jenkins-Session: 77c90621
Client: 10.0.0.2
Server: 172.0.0.2
However, when trying to get to start a slave node, I get this error reported on the slave node:
INFO: Locating server among [http://myjenkinsurl:7004]
May 25, 2017 12:22:12 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: http://myjenkinsurl:7004/tcpSlaveAgentListener/ is invalid: 404 Not Found
I also get the 404 Not Found error when curling http://myjenkinsurl:7004/tcpSlaveAgentListener/
This is what my relevant section of Configure Global Security looks like:
I am getting this error since upgrading to Jenkins 2.62 and it was previously working with a similar configuration on Jenkins 2.19.
Most of the similar queries I can find to this question do not have this additional port configured correctly, but the output I get from curling Jenkins on this set port, 7004 in my case, seems to indicate that this is not where the problem lies.
How do I get the tcpSlaveAgentListener URL to function?
My case, I'm running both: master and the slaves on Kubernetes.
The challenge of getting this working under a ingress apart, I was getting a similar error, and if I understood it right:
the /tcpSlaveAgentListener/ should exist under Jenkins main port (usually 8080).
This URL, you configure at Manage Jenkins -> Configuration-> Cloud / Kubernetes
Jenkins URL: http://jenkins:8080
Then, under Manage Jenkins -> Global Security-> Agents
TCP Port for inbound agents: 50000.
Here you can't use the same port as your main service for Jenkins.
I'm running also master and slaves on kubernetes
What I did to correct the error is to set up two different jenkins urls:
ingress url
Manage Jenkins > System configuration > Configure system > Jenkins location > Jenkins url: https://jenkins.local/
jenkins service url
Configure clouds > Kubernetes > Jenkins url: http://jenkins-service:8080

Jenkins Build Slave - Connection not possible

I would like to connected via JNLP to the Master Jenkins server and getting always following error
Failing to obtain https://<master-server>/buildserver/computer/CaptainBrowser/slave-agent.jnlp?encrypt=true
java.io.IOException: https://<master-server>/buildserver/computer/CaptainBrowser/slave-agent.jnlp?encrypt=true doesn't look like a JNLP file; content type was text/html; charset=iso-8859-1
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:306)
at hudson.remoting.Launcher.run(Launcher.java:219)
at hudson.remoting.Launcher.main(Launcher.java:192)
I had a similar problem. For me the issue was that the Jenkins URL in 'Configure System' was set to 'http://...' instead of 'https://...'. This meant that when I set up a node, it showed the java command to run to be also use http. E.g it said
java -jar slave.jar -jnlpUrl http:///computer//slave-agent.jnlp -secret
Running it yielded
'Failing to obtain http:///computer//slave-agent.jnlp?encrypt=true'
Changing the server URL to 'https' enabled it to work for me. It changed the command for a Jenkins node to be a 'https' URL and running that worked.
Goto jenkins --> Manage jenkins --> configure system --> http://yoursystem ip:8080/ Make sue it will be http not https. Manage Jenkins --> Global security--> Agent -->
TCP port select fixed 50000 and Inbound TCP Agent Protocol/4 (TLS encryption) under agent protocol
Create Agent node gain it will work
In my case, it started working after adding HTTPS protocol to my security group for EC2 machines. Then again run jnlp command on to jenkins slave terminal and it will be connected.

Unable to follow sandbox link in Apache Mesos

I have a mesos cluster setup with a master and slave on separate hosts on GCE. In the mesos console I can see the list of tasks - but the sandbox link isn't working.
I'm getting this error
Failed to connect to slave '20150806-140802-3049385994-5050-1-S0' on '4c37a1dd950b:5051'.
Potential reasons:
The slave's hostname, '4c37a1dd950b', is not accessible from your network
The slave's port, '5051', is not accessible from your network
The slave timed out or went offline
4c37a1dd950b is on the same server as the master.
Any tips appreciated

Resources