Jenkins Windows Slave Configuration with Screenshots

In our last articles, we have discussed how to Install and Configure Jenkins and how to Configure Jenkins Master-Slave setup on Linux machine

I have received few requests/suggestions through my last article  Jenkins Master-Slave setup on Linux machine to share the approach on Configuring Jenkins Slave on Windows Machine

So here I am with our new article on How to Configure a Jenkins Slave on Windows Machine and Install it as a windows Service

jenkins-windows

1- Login to Jenkins and Click on Manage Jenkins

jenkins-windows-slave-creation-1

2- To create a new Slave – Click on New Node

jenkins-windows-slave-creation-2

 

3- Name the node

jenkins-windows-slave-creation-3

 

4- Fill all the required details.

Please refer our master-slave configuration article to know all the details of parameters present in the node configuration page

 

jenkins-windows-slave-creation-4

5- Choose the appropriate Launch method

jenkins-windows-slave-creation-5

 

Below mentioned steps to configure and enable security are very important steps.

If you miss this you might not be able to start/configure the Jenkins slave because by default Jenkins disabled the TCP Port for JNLP agents and due to this Agent is not able to reach Master.

 

6 – Again click on Manage Jenkins

jenkins-windows-slave-creation-1

7- Then click on Configure Global Security

jenkins-windows-slave-creation-7

 

8- Find out the Enable Security option

jenkins-windows-slave-creation-8

9-  And then change the

jenkins-windows-slave-creation-9

10- Once the new node is created, it will be in Offline mode

jenkins-windows-slave-creation-10

11- Now click on the Slave agent

jenkins-windows-slave-creation-11

12- You will see Agent is not able to reach the master Jenkins and the new jnlp jar can be downloaded from Jenkins

 

jenkins-windows-slave-creations-12

13- Open the Jenkins URL from Agent Windows Machine and navigate to Slave Configuration page

Once done, just click on Launch Button – You will see a new popup which confirms the Jenkins Master-Slave Connection.

jenkins-windows-slave-creations-13

Lets now create and install this as a Windows service which will avoid the hassle to go to url and perform the same operation every time.

Once you create the service it will always be up & running and then you can manage it through Windows Services

14- Don’t close the pop-up, instead just click on File Menu – If its not visible just maximise the popup window

jenkins-windows-slave-creation-14

15- Now, just click on Install as a service option

jenkins-windows-slave-creation-15

 

16- It will prompt you for the confirmation

jenkins-windows-slave-creations-16

17- Just click on OK

jenkins-windows-slave-creation-17

18- Go to Windows Settings and then to check the Windows Services

jenkins-windows-slave-creation-18

19- You can see the Jenkins Windows Slave is successfully configure and running (If not then just Start the Service)

jenkins-windows-slave-creation-19

 

20- Go back to your Jenkins Slave Page and now you will see that Agent is Successfully Running and ready to build your project

jenkins-windows-slave-creation-20-done

Thats it. You have successfully configured the Jenkins Slave on Windows Machine and Installed it as a Windows Service.

47 thoughts on “Jenkins Windows Slave Configuration with Screenshots”

  1. Hi Ravi,
    Very informative documentation. Appreciate your efforts.
    Can you please help me in setting up Windows slave server using launch method “Launch slave agents via ssh” instead of Java Web start?

    1. Hi Bhimsen,
      Thanks for your feedback and sorry for delay in reply.
      The easiest way to connect windows slave is with Java Web start, however there are cases where you need to use ssh for some reasons.
      Have you considered and tried with Cygwin for Windows ? “https://wiki.jenkins.io/display/JENKINS/SSH+slaves+and+Cygwin” or Freesshd “http://www.freesshd.com/?ctt=overview” for the same ?

  2. Hi Ravi,
    Thanks for your information.
    When we click on “Launch” button, an authentication pop-up is showed, we put our admin login, then we have a Jenkins window , and after some seconds, we have an error-popup Java.io.Exception failed to connect………
    Can you please help me on this:)
    Thanks in advance,
    RaviKumar

    1. Hi Ravikumar,

      Thanks for your query.

      As there is very limited information provided, Hope this issue isn’t due to Java version issue https://issues.jenkins-ci.org/plugins/servlet/mobile#issue/JENKINS-27624

      Also please refer another support request which was raised by an user who has faced similar issue – https://support.cloudbees.com/hc/en-us/articles/115002626192-Slave-Setup-agent-fails-to-launch

      If above doesn’t help then please could you provide detailed master and slave jenkins logs to find out actual error.

  3. Hi Ravi,
    Thanks for your quick reply.
    The issue is not with the java version,as you mentioned in above screenshots i’m facing issue at step14 .
    After the jenkins slave pop-up i’m not finding the File Menu option to inastall as a service even maximized mode and after some time Error window pop-up appearing with the logs like..
    java.io.IOException:Failed to connect to URL:50000
    at org.jekinsci.remoting engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:242)…
    …..
    any suggessions!
    ThankYou

    1. Did you try to check whether the port is accessible or not ?
      Have you made any changes to Iptables?
      By default, JNLP slave port configured as random – Have you tried with making fixed port or open Iptables over your firewall or configure port forwarding?
      If these also not working for you then, please share the network architecture of your master-slave connectivity and error logs.

  4. Hi,

    When I clicked on Launch button from my agent, I see slave-agent jnlp file getting downloaded. I dont see any popup for making my agent as slave. What do I do now?

    Thanks,
    Rashmi

    1. Hi Rashmi,
      Thanks for your query.
      Have you checked the browser settings (it should not block pop-ups), I would suggest to try on other browsers as well (IE, Firefox, Chrome, etc)
      However you can also make your agent as Jenkins slave through command line :

      Just run the below command with correct parameters as per your installation from your slave path:

      $ java -jar slave.jar -jnlpUrl http://yourserver:port/computer/slave-name/slave-agent.jnlp (You can refer the full command which should be displayed on your launch screen)

      Please make sure you are running this command from the location where the slave.jar was copied.

      If you see any error in download/ or fail to download – you can get the copy of your slave.jar from http://yourserver:port/jnlpJars/slave.jar

      Hope this helps and resolves your issue

  5. Hi,
    My slave machine is unable to reach to my masters as the port is not reachable.
    It was working till yesterday, I am not sure how to change the port number. I have created a Jenkins as a service(JAAS)

    1. Hi Susmit,

      Thanks for your query. You first should find out the root cause of the issue.

      Assuming both your Jenkins master and slaves are on Windows

      Check jenkins master’s & slave’s logs for details

      Then check windows logs through Event Viewer

      You can open Jenkins.xml to verify which port is used by Master

      Try to see if Jenkins is still listening to that port
      On Command Prompt : netstat -ano | findStr “portnumber”

      Use netsh to define the incoming/outgoing ports

      You can also verify the master-slave connection as suggested in oficial article

      1- Use jenkins-cli to check the connection
      In the slave box download http://JENKINS_URL/jnlpJars/jenkins-cli.jar from Jenkins master and execute the command below:

      java -jar jenkins-cli.jar -s http://JENKINS_URL/ –username=USERNAME –password=PASSWORD help

      Check that the JNLP port and hostname are right

      2- Launch the commands below and check that the port and hostname are the right ones:

      curl -I http://JENKINS_URL/computer/SLAVE-Host/slave-agent.jnlp
      curl -I http://JENKINS_URL/tcpSlaveAgentListener/

      In case you suspect you have a firewall between the master and the slave, you need to configure the port number under JenkinsMasterURL/configureSecurity

      Check if that works.

  6. Hi Ravi,
    I’ve followed the same steps in the above article, but my slave agent is still offline. If I launch the slave agent using Java web start, then it’s working fine. But when I install it as service, it’s going offline. Even remoting log says nothing.
    Please help!
    Thanks.

      1. Thank you Ravi for the prompt reply. I could see the ‘File’ menu, and could install the service as an admin. But still the agent shows offline. My slave machine is in a private network behind firewall and port 50000 is open for communication. Did I miss anything ?

        1. Hi Krishna,
          Since you can use Java web start method without any issue, it shouldn’t be an issue of firewall.
          Can you please change the service “Log on as” : Local System account and verify if that works ?

          1. Hi Ravi,
            I’ve tried running service as Local System User. Unfortunately, the slave agent is offline. I’ve noticed an error in Event Viewer, it says ‘Failed to download https:///jnlpJars/slave.jar to \slave.jar’. Is that any clue to find the cause ?

          2. Hi Krishna,
            When you download the slave.jar as mentioned in Step 13. Are you getting a pop-up which confirms connection ?
            Are you getting “File” menu in the popup ?
            Are you getting “Install as a service” option ?
            Can you locate newly installed service (if you get the option) in Services ?

            You can also install service from command prompt, please refer https://scmquest.com/jenkins-file-menu-missing/
            Let me know if you still get any issue

  7. Hi Ravi,
    I appreciate your prompt response. As mentioned in step 13, when I click on Launch button, slave.jar is being downloaded. A pop up asking for connection appearing and I could make connection. I could even see File menu and Install as service option. When I install as service, the pop up is closing and agent is going offline. Hope you understand my problem.
    Thanks.

    1. To add to the above, I could locate the service in windows services.msc. I am using ‘Local System Account’ as Log on option of the jenkins service. The issue still persists. Agent is offline.

        1. Hi Ravi,
          Thank you for your support all the way. I’ve sorted the issue by myself. I have seen an error in Event viewer after setting up windows service. The error is related to downloading slave jar file. Since my machine is behind firewall, I had to open port related to HTTP in firewall and repeated the above mentioned steps by you. I’m sharing this so that it might help someone like me.
          Thank you for the blog by the way. I liked it. Keep sharing the learning 🙂
          Cheers.

          1. Hi Krishna,
            Thanks for sharing your feedback and glad you were able to resolve the issues.
            You earlier said you were able to run the slave but were not able to set the service and that’s the reason i commented that it doesn’t seems to be a firewall issue, but happy you manage to sort it out.
            Keep questing !!

  8. Hi Ravi,
    I’ve encountered a new issue after setting up windows service. My jenkins build job is unable to clone github repo now. But if I stop the service and connect via ‘Java web start’ it is working as usual. Do you know why it is happening ? Could you help sort this out ?
    Thanks.

  9. This Jenkins instance uses deprecated protocols: JNLP-connect,JNLP2-connect,JNLP3-connect. It may impact stability of the instance. If newer protocol versions are supported by all system components (agents, CLI and other clients), it is highly recommended to disable the deprecated protocols. See Protocol Configuration

    Hi,guy
    I has setup a win10 slave on Jenkins 2.176.1,but there is a warning.
    Then,which launch method can I use?and how configure it?

    Sorry for I cannot find the post date of this article,maybe is too old and you do not attention it long times.

  10. My master in Linux server and I am setting Slave as Windows.
    I am getting this error : java.io provided port 35107 is not reachable.

    1. Hi Sakshi,
      Thanks for your query.
      To sort out this issue, we need more details, such as
      – Was this connectivity working earlier or this is the first time setup ?
      – Have you checked if JENKINS_TUNNEL is defined ?
      – Have you tried to check the connectivity (slave to master server) as described in comment: https://scmquest.com/jenkins-windows-slave-configuration-with-screenshots/#comment-3217

      Please try once with above and share detail log in case the issue still persist.

  11. In my case (Linux) Jenkins master is having few slaves as windows and Linux.
    1.we are using gitlab for Scm at present and we are moving to git hub
    2.Existing Jenkins jobs runs on windows and linux slaves are working fine with gitlab integration and build also successful.
    3. when we changes the repo url from git lab to git hub that runs on windows slave node it is giving
    “ERROR: Timeout after 10 minutes
    ERROR: Error fetching remote repo ‘origin’
    hudson.plugins.git.GitException: Failed to fetch from repo URL”

    but it is working fine for linux slaves.
    4.Credential vise same applicable to all jobs(Windows and linux) and provides access to user as well in github.

    Any help here is appreciated

    Thanks,
    Vikas

    1. Hi Vikas,

      Did you reset the credentials on Windows slave ?
      Run as admin and restart slave
      git config –global –unset credential.helper
      git config –system –unset credential.helper

      Are you able to connect to GitHub repo from Windows slave (check for any proxy, firewall issue) ?

      If issue persist, please provide the full stacktrace – hope this helps

  12. Super I have seen for this information how to create windows slave as a service I understand to see this artical super sorcerer keep manage like this thanks once again sir

  13. I had configured and executed job in the Windows Slave node but while I traversed to Workspace and then report directory which was created by angular test , it is giving –
    A problem occurred while processing the request.
    Logging ID=42e97286-36e5-4880-86a5-f8983e90248b

    1. Hi Vinod,

      Please could you provide more details about the issue ?

      -> Did you verify the workspace on windows server ?
      -> Was the folder created ?
      -> What are the errors you are seeing in the Jenkins logs ?
      -> Is it happening with any other Job ?

      And some other useful details – thanks

  14. Hi,
    help pls with below. i am doing on windows.
    i have installed slave node.

    need help with beloe :
    Install python, openssh-server and git on the slave node manually
    •Set up the necessary tools such as git, chromedriver(selenium), chromium browser(selenium) on the slave node through Ansible.

    1. Hi Hema,
      It would be a very wide guess on what exactly causing the issue without the appropriate details.
      Please could you share more details about it, such as
      – windows/linux?
      – same subnet or different?
      – firewall checked?
      – ports are open?
      – security configuration checked?
      – any evidence in error message?
      – etc, etc

  15. Pingback: How to launch Windows Slave from Linux Master in JENKINS – Windows Questions

  16. I am having Jenkins master on Linux/CentOS7, and I am trying to setup the Jenkins slave on Windows ( both master and slave are on AWS). I have configured the TCP inboud port fixed 50000 and have created security group to allow inbound access to 50000 port on the slave. I am able to launch the Jenkins dashboard from the Slave machine, and from the node menu when I try to launch the slave it still gives this java.IO.Expection http://xx.xx.xx.xx:8080 provided port 50000 is not reachable

    1. Hi Parag,
      It looks like issue with the firewall ports.
      Can you please check if the port is open or not on server level
      sudo firewall-cmd --list-ports

      and if not, then please add it
      firewall-cmd --permanent --add-port=50000/tcp

Leave a Comment

Your email address will not be published. Required fields are marked *