Anandhi K
4 min readJun 27, 2022

Jenkins Master Slave Configuration (Ubuntu Master & Windows Slave )

In this article we talk about how to connect two different remote machines having Ubuntu and Windows. Here we will configure Ubuntu 20.04 as Jenkins Master and Windows 10 as a Slave node.

Jenkins Master and Slave Concept

A Jenkins master comes with the basic installation of Jenkins, and in this configuration, the master handles all the tasks for our build system.

If we are working on multiple projects, we may run multiple jobs on each project. Some projects need to run on some nodes, and in this process, we need to configure slaves. Jenkins slaves connect to the Jenkins master using the Java Network Launch Protocol(JNLP).

Master Slave Architecture

The Jenkins master acts to schedule the jobs, assign slaves, and send builds to slaves to execute the jobs.

It will also monitor the slave state (offline or online) and get back the build result responses from slaves and the display build results on the console output. The workload of building jobs is delegated to multiple slaves.

Steps to Configure Jenkins Master and Slave Nodes

Click on Manage Jenkins -> Manage Nodes and clouds.

Select New Node and enter the name of the node in the Node Name field.

Select Permanent Agent and click the OK button. Initially, you will get only one option, “Permanent Agent.” Once we have one or more slaves you will get the “Copy Existing Node” option.

Configure node with below details,

Under ‘Node Properties’, provide jdk path.

On click of ‘Save’ will display the below page with error message. Here Jenkins connect with Windows Slave node using Java Web Start and it needs a port to establish the connection.

To configure JNLP port in global security. Now goto Manage Jenkins -> Configure Global Security

This port has to be allowed to access across firewall, so from Master terminal run the below command,

sudo ufw allow 50000/tcp

This command will allow port 50000 to listen for request.

Again coming back to Jenkins and navigate to Nodes -> WinNode which will display two ways to connect with Agent node.

Download this agent.jar file by clicking on that filename into Jenkins Master Node. Copy this file to Slave machine under c:\JenkinsSlave folder. Here /JenkinsSlave is a custom folder name.

Now in the Slave node launch CMD prompt and point to c:\JenkinsSlave folder.

To establish connection, run the below command

java -jar agent.jar -jnlpUrl http://10.0.1.100:8080/computer/WinNode/jenkins-agent.jnlp -secret 5715c0defc80a19e8d2beb0ae24c286ea26e9f3e4c4e06e5f8cacb52753ad160 -workDir “c:\JenkinsSlave”

Sometimes Jenkins may generate random ip address in Url(http://10.0.1.100:8080). Instead update this to your Jenkins server ip address.

This will establish connection with the configured Slave node.

Now Jenkins Slave node is ready to run any job. This node’s label name should be mentioned in the corresponding Job configuration as below,

Since we want to run this job in Windows environment, I selected ‘Execute Windows batch command’ option.

Apply & Save.

In Jenkins Console ouput,

Conclusion:

This way we could connect with many machines as Slave nodes with different environment and execute our Jenkins jobs.

Anandhi K
Anandhi K

Written by Anandhi K

DevOps Test Automation Consultant, Trainer and Blogger in Cypress, Selenium, Cucumber, Playwright & CI/CD Tools.

No responses yet