Jenkins Master Slave Configuration. (Ubuntu instance as a slave)
Connect Ubuntu server as a Slave - Using Private Key
Hi everyone ! In my Internship project, I had to configure a Ubuntu Instance as a Slave/Node to run a Jenkins job. That Instance runs in a AWS server. In this blog I'll show in simple steps how I configured that instance as a slave in Jenkins.
I needed the following details about the instance.
IP of the Ubuntu instance.
User name (which is configured in the instance)
My private key
Step 1 :
Go to Manage Jenkins from the left menu
Step 2 :
Select Manage Nodes
Step 3 :
Select New Node and enter the node details.
1. Name - Name of the node. This name will get displayed in the main view, under nodes section.
2. Description - A Description. Better to include details about RAM, CPU storage etc.
3. # of executors - The maximum number of concurrent builds that Jenkins may perform in this node.
4. Remote root directory - Specify a directory in the agent node. (Note that the workspace will get created inside this directory in the slave node.) Best to give the absolute path.
5. Labels - Needed when assigning jobs to the node. You will have to mention this label in the job configuration to get your work done in this node. Can use 1 or more label names (Multiple labels must be separated by a space)
6. Launch method - Select Launch agents via SSH
7. Host - Enter the node's IP.
8. Credentials - Click on Add to create new credentials and select Jenkins.
i. Kind - Choose SSH Username with private key.
ii. ID - Add something unique to identify the credentials.
iii. Description - A description about the credentials.
iv. Username - Enter the user which is configured in the Slave node here.
v. Private Key - Enter your private key (copy paste)
Finally the credentials will look something like this.
8. Click Add.
Now choose the newly created credentials from the drop down menu.
Below those settings, You can add some other details under Node Properties.
For example - You can set up the Environment details as below.(such as bin locations of several tools etc)
Also You can select and add Tool Locations. (Maven path, JDK,node path etc.)
Step 4 :
Finally Click Save and you will see the Created Node. It launches the agent automatically.
Step 5 :
Test the node by creating a Jenkins job.
Step 6 :
Comments
Post a Comment