Passionate Engineer
Passionate Engineer

Reputation: 10412

Jenkins JNLP slave with ELB

Is there a way to integrate JNLP slave endpoint with ELB?

Whenever I use ELB endpoint with listener port 50000 to EC2 instance 50000 I get:

INFO: Connecting to app.ap-southeast-2.elb.amazonaws.com:50000
Aug 11, 2017 9:05:54 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP-connect
Aug 11, 2017 9:05:54 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Protocol JNLP-connect encountered an unexpected exception
java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Server didn't accept the handshake: HTTP/1.1 400 BAD_REQUEST
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at hudson.remoting.Engine.innerRun(Engine.java:385)
    at hudson.remoting.Engine.run(Engine.java:287)
Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Server didn't accept the handshake: HTTP/1.1 400 BAD_REQUEST
    at org.jenkinsci.remoting.engine.JnlpProtocol1Handler.sendHandshake(JnlpProtocol1Handler.java:121)
    at org.jenkinsci.remoting.engine.LegacyJnlpProtocolHandler$2.call(LegacyJnlpProtocolHandler.java:162)
    at org.jenkinsci.remoting.engine.LegacyJnlpProtocolHandler$2.call(LegacyJnlpProtocolHandler.java:158)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at hudson.remoting.Engine$1$1.run(Engine.java:94)
    at java.lang.Thread.run(Thread.java:748)

Aug 11, 2017 9:05:54 AM hudson.remoting.jnlp.Main$CuiListener error
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
    at hudson.remoting.Engine.onConnectionRejected(Engine.java:484)
    at hudson.remoting.Engine.innerRun(Engine.java:448)
    at hudson.remoting.Engine.run(Engine.java:287)

However when I change the JNLP endpoint url to EC2 instance directly it works fine without any errors.

It seems though ELB is doing some translations that isn't accepted by Jenkins master.

Has anyone have got JNLP connection working from Jenkins slave to master via ELB?

Thanks,

Upvotes: 2

Views: 2667

Answers (1)

tpkiminki
tpkiminki

Reputation: 11

If you want to publish all services via same load balancer (so you can use just 1 domain name) you can use the Classic Load Balancer. With that you can create 2 listeners --> Example 1 https (with ACM ssl certificate) that proxy/offload traffic to Jenkins port HTTP:8080 and other tcp:50000 that forward/bridge traffic to backend servers port 50000.

Upvotes: 1

Related Questions