Jenkins- Key Concepts Add a slave (Part-2)

Updated: Sep 1, 2020

Hello Readers, in the last article we started with jenkins, installed it and executed a small jenkins job. Let's move forward and learn more about it ...

Jenkins: Important terms and concepts

  • Job : A Jenkins job is any task that a jenkins server can execute.Note that job is an old term now which has been replaced by new term which is called a Project . One common type of project is a Freestyle project which is really simple to execute and helps in running simple shell scripts and windows batch jobs.

  • Jenkins Pipeline : This type of project used to be called a Workflow . This is an important type of project type that helps us doing multiple executions in steps,let us define dependencies, and sequence in which different stages of a pipeline should execute.

  • Jenkins Build : A build is a result of single execution of a project.

  • Build Trigger : A criteria for starting a new pipeline run or a build.

  • Artifacts and Repositories : This refers to the immutable files that are generated as a result of pipeline or a build excution. A single build can have multiple artifacts associated with it , these can be jar files, war files, configuration files etc.

  • Repositories : The artifacts produced might be required in future so these are kept in a repository which is most of the time a source code management tool such as git or github.

Configure Jenkins Slave Server

In case we have to setup jenkins in a big environment, having really large number of servers, we will have to distribute the load of jenkins master server and configure jenkins slave server.

We are going to do the same now. We have to now login to the other machine (node2) and do the following things so that it behaves as a jenkins slave.

  • Create a user jenkins and provide root level sudo access.

[root@node2 ~]# useradd jenkins
Creating mailbox file: File exists
[root@node2 ~]# passwd jenkins
Changing password for user jenkins.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.

jenkins ALL=(ALL)       NOPASSWD: ALL
  • Install java

yum install java-1.8.0-openjdk
  • Note that its not required to install jenkins on a jenkins slave server.

  • Last but not the least, we will have to setup pass wordless ssh between jenkins master and jenkins slave server.On the jenkins master, execute the below commands.

[root@node1 ~]# su - jenkins
Last login: Mon Jun  8 11:52:01 IST 2020 on pts/1
-bash-4.2$ whoami
-bash-4.2$ ssh-keygen # Now keep on pressing enter key to select default values
  • Login to the jenkins console and follow the below steps.

  1. Go to the the jenkins home page and click on Manage Jenkins on the left hand side

  2. Click on Manage Nodes And Clouds and then the below screen will appear.

3. Click onNew Nodeon the left hand side and give a name to it

4. Now fill in the details as shown in the below image.

5. Next we will store the credentials for jenkins user and mention the password in it . There are a number of ways to achieve the same, we can give ssh keys as well.

6. Give the credentials created in the last step.

7. Just wait for a minute and our jenkins slave should be working as shown below.

Oh yeah !! Hope you are enjoying this series of tutorials. Lets move forward and learn about pipelines in jenkins and related concepts.

376 views0 comments

Recent Posts

See All