By default the jenkins initiates the builds from the jenkins master. But if you are using the jenkins in an production environment there are chances several builds for different components/ micro services would be required to triggered parallely.
In case the IO/Network/System performance for the master may degrade and UI or jenkins might start to give reduced performance , hangs up etc. which is not a desirable state. So its recommended to use the jenkins slave for the builds while master only control those nodes.
To add the jenkins slave you need to have the two server's first one is your master server and other one the slave server on which you are going to build the jobs created in the jenkins.
For this you require to have 2 servers in our case we are going to use 172.31.59.1 as the jenkins master and 172.31.62.152.
You need to install the java jdk on both the servers. For installing java jdk and setting up the environment variables follow my previous posts Java JDK Installation and jenkins installation.
Ensure the jenkins user exist on both the servers and generate a key on the jenkins master server using the ssh-keygen command and copy this key using the ssh-copy-id command on both the servers to make them passswordless from the jenkins master server.
Once done go to the jenkins dashboard
Click on Manage Jenkins
Click on the New node options to add another server to jenkins as slave
Check out on the left column under the build executor status, you should see the slave node over there also. Next you need to change the configuration on the master so that most of the jobs build are triggered from the Slaves only and master is used for the specific jobs with parameter. Start by selecting the master node
Click on configure to configure the master node
By Default , under the usage option you would see "Use this node as much as possible" would be selected, we need to change this. click on the drop down option to change it
Select the option as show below and click save
This completes the slave server addition to the jenkins.
If you want to test that infact the jobs are triggered from the slaves only,you can create a simple job to test the underlying operating system, kernel version, hostname and ip of the system from which the jobs is being built and see the output in the jenkins console.
Click on the Console Output
Output clearly shows the job has been built on the Slave node only.
In case the IO/Network/System performance for the master may degrade and UI or jenkins might start to give reduced performance , hangs up etc. which is not a desirable state. So its recommended to use the jenkins slave for the builds while master only control those nodes.
To add the jenkins slave you need to have the two server's first one is your master server and other one the slave server on which you are going to build the jobs created in the jenkins.
For this you require to have 2 servers in our case we are going to use 172.31.59.1 as the jenkins master and 172.31.62.152.
You need to install the java jdk on both the servers. For installing java jdk and setting up the environment variables follow my previous posts Java JDK Installation and jenkins installation.
Ensure the jenkins user exist on both the servers and generate a key on the jenkins master server using the ssh-keygen command and copy this key using the ssh-copy-id command on both the servers to make them passswordless from the jenkins master server.
Once done go to the jenkins dashboard
Click on Manage Jenkins
Click on the New node options to add another server to jenkins as slave
Enter the Name of the Node which is used to identify the node and its role. Select the option Permanent Agent and click Ok.
Enter the Details as shown in the snapshot below and enter the slave node host configuration and select the key through which jenkins master can connect to this server
After saving the configuration you should see an additional node but the node would not be available yet jenkins would check the java version and connect to it to make it online automatically. click on the node
Click on the Log option to see the logs being written by jenkins while make the slave node available
You can see the jenkins access the slave node , checks for the java version available which we have already installed previously on this node and makes it online. The online status confirms the node is available for the use
Click on configure to configure the master node
By Default , under the usage option you would see "Use this node as much as possible" would be selected, we need to change this. click on the drop down option to change it
Select the option as show below and click save
This completes the slave server addition to the jenkins.
If you want to test that infact the jobs are triggered from the slaves only,you can create a simple job to test the underlying operating system, kernel version, hostname and ip of the system from which the jobs is being built and see the output in the jenkins console.
Click on the Console Output
Output clearly shows the job has been built on the Slave node only.
0 comments:
Post a Comment