How to configure build agents for Jenkins 2.0

Jenkins is an open-source automation tool used to build, test, and deploy code. Jenkins follows the leader/follower paradigm in which we can run our code on different slaves or agents. In this answer, we'll learn to configure the build agents in Jenkins 2.0.

Steps

  1. Click on the "Manage Jenkins" button.

  1. In "Manage Jenkins" under "System Configuration", select "Manage Nodes and Clouds".

  1. Click on the "New Node" button to create a new agent in the left menu.

  1. Now provide the agent/node/follower name and click on "Create".

  1. It will open up a form to fill in the agent details.

    1. Provide the number of executorsThis tells number of parallel jobs to run in an agent.. Here, we have given 4.

    2. Provide the root directory path.

    3. Provide the label name.

    4. Provide the launch method. Here, we choose the option "Launch agent by connecting it to the controller".

    5. Click the "Save" button to save the agent configuration.

  1. Now, the agent is created, but we haven't yet connected to it to run any pipelines on it. To connect to the agent follow any method shown in the below image, we can get the commands to connect from the agent page we just created.

  1. Now the agent is connected.

  1. We have created an agent and connected to it successfully. Now we can run the Jenkins pipeline on it. To do it, open any of your Jenkins pipelines and provide an agent. Here, we gave the agent as "Agent1".

Now, when you run your pipeline, it will run on that agent.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved