Jenkins Master and Slave configuration

Amarnath Nachimuthu
3 min readApr 9, 2023

Prerequisites

  1. Install Java on the master node
  2. Install Jenkins on the master node
  3. Install Java on the slave node

To install the Jenkins master node and Java, refer to the below link

Jenkins Master and Slave configuration

Steps

Go to Manage Nodes and Clouds in Jenkins by navigating to Manage Jenkins

Click on the “New Node” button to add a new node.

In the Node configuration page, enter the following information:

Name: This uniquely identifies an agent within this Jenkins installation.

Description: A brief description of the node.

The number of executors: The number of build executors on this agent.

Remote root directory: The root directory on the agent where Jenkins will store files.

Labels: Labels (or tags) group multiple agents into one logical group.

Usage: I am selecting the option ‘Use this node as much as possible’ for the usage. However, the suitable option may vary depending on your specific use case.”

Launch method: Launch the agent by connecting it to the master

Custom WorkDir path: custom Remoting work directory will be used instead of the Agent Root Directory, and choose the “Use WebSocket.”

Availability: Select when the agent should be available:

Once you have entered all the required information, click on the “Save” button to save the configuration.

After saving the configuration, you will get a command which should be executed on the agent. This command contains the agent.jar, a secret-file, and a jnlp file. Copy this command and execute it on the agent to connect it to Jenkins.

java -jar agent.jar -jnlpUrl http://13.75.91.198:8080/manage/computer/Slave%20Node/jenkins-agent.jnlp -secret 8ffd8a6460b9e7c9b80dca190 &

  • The ampersand symbol (&) will execute the command as a background task.

Once the agent is connected to Jenkins, it will be available to run build jobs.

NOTE:

Updating Jenkins URL on AWS server: In the case of an AWS server, ensure that the Jenkins URL is updated to the latest public IP address to maintain uninterrupted connectivity.

Java version consistency: The Java versions on the master and slave should be the same to avoid compatibility issues.

--

--