Adding and Configuring Jenkins Nodes for Pipeline Efficiency


I'll walk through the process of setting up and configuring nodes (agents) in Jenkins. Jenkins nodes allow distributed builds, enabling workload balancing and speeding up the CI/CD pipeline. By following this step-by-step documentation, you’ll set up a node and configure it to handle jobs effectively.
Prerequisites
Jenkins Server with administrative access.
Network Configuration that allows SSH access between Jenkins Master and Node.
Credentials for SSH access to the remote node.
Steps to Set Up a Jenkins Node
Step 1: Navigate to Build Executor Status
Go to your Jenkins dashboard.
Locate and click on Build Executor Status in the sidebar.
Step 2: Open the Nodes Configuration
- In the Build Executor Status view, click on Manage Nodes and Clouds or simply New Node to start adding a new node.
Step 3: Create a New Node
Click on the New Node button.
Provide a Node Name (e.g.,
my-first-node
) and select Permanent Agent as the type.Click Create to proceed to configuration.
Step 4: Configure Node Settings
In the configuration page, enter details such as:
Remote Root Directory: Specify the home directory on the node, e.g.,
/home/rabiatu
.Labels: Add labels if needed for grouping or organizing jobs on specific nodes.
Usage: Choose
Use this node as much as possible
.Launch Method: Select
Launch agents via SSH
.
Enter the Host IP of the node, e.g.,
192.168.0.21
.
Step 5: Add SSH Credentials
Under Credentials, click Add and select Username with Password.
Fill in the credentials for the user that has SSH access to the node.
Username:
rabiatu
Password: [your password]
Click Add to save these credentials.
Step 6: Choose Host Key Verification Strategy
Set Host Key Verification Strategy to
Manually trusted key Verification Strategy
.This setting ensures secure SSH communication with the node.
Finally, click Save.
Step 7: Note - Verify Node Connection
After saving, Jenkins will attempt to connect to the node using the provided settings. You should see the node listed in the Build Executor Status and available for job assignments.
Creating a Freestyle Job for Testing the Node
Step 1: Create a New Job
From the dashboard, click on New Item.
Enter a name for your job (e.g.,
node-project
).Choose Freestyle Project and click OK.
Step 2: Configure Job to Run on Node
In the General section of the job configuration, check Restrict where this project can be run.
Enter the label you used for the node (e.g.,
my-first-node
) in the Label Expression field.Click Save to apply these settings.
Step 3: Add a Simple Build Step
Go to Build Steps and select Execute Shell.
In the command field, enter a simple command, like:
Click Save.
Running and Verifying the Job on the Node
Step 1: Trigger the Build
Go to the project’s dashboard and click Build Now to start the build.
Step 2: Check Console Output
Click on Console Output to view the log and verify if the build ran successfully on the designated node.
You should see a success message along with the output:
Finished: SUCCESS
Conclusion
Setting up nodes in Jenkins enhances the efficiency of your CI/CD pipeline by distributing jobs across multiple agents. This guide walked through the essential steps to add, configure, and test a node in Jenkins. With nodes in place, your Jenkins setup can scale to meet more complex, high-demand workflows.
Troubleshooting Tips
SSH Connection Issues: Ensure that the Jenkins server can access the node over SSH. You might need to adjust firewall settings or check that the SSH service is running on the node.
Authentication Failure: Verify that the credentials (username and password) used are correct and have appropriate permissions.
Label Mismatch: If the job doesn’t run on the node, check the label spelling and ensure it matches exactly with the node label.
Subscribe to my newsletter
Read articles from Rabiatu Mohammed directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Rabiatu Mohammed
Rabiatu Mohammed
CLOUD ENGINEER | DEVOPS | SECURITY