Windows Jenkins Slave unable to connect to master hosted on Openshift instance

611 Views Asked by At

Unable to connect jenkins master hosted On Openshift Cluster. Terminates with below error after handshaking:

may 23, 2020 2:05:55 PM hudson.remoting.jnlp.Main$CuiListener error
GRAVE: Failed to connect to jenkins-jnlp-poc:50000
java.io.IOException: Failed to connect to jenkins-jnlp-poc:50000
        at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:246)
        at hudson.remoting.Engine.connectTcp(Engine.java:678)
        at hudson.remoting.Engine.innerRun(Engine.java:556)
        at hudson.remoting.Engine.run(Engine.java:488)
Caused by: java.net.ConnectException: Connection timed out: connect
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:454)
        at sun.nio.ch.Net.connect(Net.java:446)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
        at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
        at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:204)
        ... 3 more

I added route to jenkins-jnlp service but I'm not able to expose the port, I'been trying to configure nodePort but I couldn't archive it yet. Any help will be welcomed! Thanks.

1

There are 1 best solutions below

0
On

A Route will only work with HTTP / HTTPS traffic and will not work in this case and as you correctly noted, NodePorts is most likely what you want. Here is an example for a Service type NodePort using Port 32000:

apiVersion: v1
kind: Service
metadata:  
  name: jenkins-jnlp-poc-service
spec:
  selector:    
    app: jenkins-jnlp-poc
  type: NodePort
  ports:  
  - name: jnlp
    port: 50000
    targetPort: 50000
    nodePort: 32000
    protocol: TCP

Note that you may need to change multiple parts of the Service:

  • The port and targetPort specifying which port the Service "listens" on and where traffic is forwarded to (typically to the port your container exposes)

  • The selector, which Pods are targeted (you'll need to check your Pods which labels are used and adjust accordingly)