Hi Readers, this document deals with how to add a node to Jenkins.

Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat.

Jenkins is one of the best DevOps tools which performs continuous integration and continuous deployment. Using Single Jenkins server would be fine only if it handles few jobs. But whenever the number of jobs increases the single server won’t be sufficient to do all the jobs. In order to solve this issue add a node/slave to the Jenkins server so some jobs can be assigned to Slave server as per the job configuration.

Here we will show you how to set up this.

Prerequisites

Two servers one with Installed Jenkins server, if not installed check this link and another server with Java Installed.

Configuration

Step 1: Login to the Jenkins UI using IP address:8080

Step 2: Once logged in go to Manage Jenkins -> Nodes

Step 3: Login to Slave server via SSH and generate ssh access key for the user. Execute the below command to generate the ssh key.

 

ssh-keygen

 

Step 4: Copy the private key

cat .ssh/id_rsa

 


Step 5: Add the public key to the authorized file

cat .ssh/id_rsa.pub > .ssh/authorized_keys

chmod 600 .ssh/authorized_keys

Step 6: Now goto Jenkin server and go to credentials

Step 7: Add new credentials.

Select Kind: SSH username with the private key
Username: SSH username of the slave server
Private key: Paste the private key which copied in step 4.

Save

Step 8: Go to Manage Jenkins and click on the new node.

Step 9: Enter the new name for the new node and mark it as a Permanent agent.

Step 10: Enter the following details

Add the home directory ex: /home/user/folder

Usage: Only jobs with label expressions matching the node

Launch method: launch agent via SSH

Host: IP address of the second server
Credentials: Select the credentials which were previously created.

Save

Step 11: Now Select the agent and click Launch agent.


Step 12: After that, you can see output says Agent successfully launched and online.


Now you have successfully added a node to your Jenkins server.
While creating a job you can assign the slave by adding the label while job configuration. So the specific job runs only in slave server only.

© 2018, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.