<p>I am looking for the way to pass JNLP though Kubernetes nginx ingress. Any advise would be strongly appreciated. Specifically I am using "Rancher 2" cluster with built in Nginx ingress.</p>

<p>In details my issue is: I am executing Jenkins master as a workflow on top of Kubernetes cluster and I would like to add external machine as a slave node to this Jenkins instance.</p>

<p>Jenkins JNLP is exposed by L7 nginx ingress with dedicated hostname, and this hostname is configure in <code>Advanced/Tunnel connection through</code> of the slave node.
I can query this address by http from the slave with curl and it returns valid response:</p>

<p><code>Jenkins-Agent-Protocols: JNLP-connect, JNLP2-connect, JNLP3-connect, JNLP4-connect, Ping Jenkins-Version: 2.176.1 Jenkins-Session: 0fe8c345 Client: 10.42.0.0 Server: 10.42.1.37 Remoting-Minimum-Version: 3.4</code></p>

<p>However with JNLP it doesn't work. When I try to register new node with this command:</p>

<p><code>java -jar agent.jar -jnlpUrl http://devops.xxxx.local/jenkins/computer/EPHEMERAL-WIN-NODE/slave-agent.jnlp -secret xxxxxxxxxxxxxxx</code></p>

<p>It returns followin error:
 <code>ConnectionRefusalException: Server didn't accept the handshake: HTTP/1.1 400 Bad Request</code></p>

<p>To make sure that it is not a connectivity issue, I changed tunneling address of the node to direct address of worker node and it is working well in this case. However, it can't be the solution, because Kubernetes can change this address dynamically.</p>

<p>The JNLP port uses a tcp protocol, not http. You can't http proxy it through nginx. You could try with nginx tcp proxying <a href="https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/</a></p>
