Jenkins Configure Master and Slave Nodes

What is Jenkins?

Jenkins is an open-source automation tool written in java that automates some of the software development lifecycle tasks like build, test, deploy, and more. In this article, we will discuss how to configure Jenkins master-slave setup also called master-slave or master-agent architecture.

Jenkins Distributed Architecture

Jenkins uses A Master-Slave architecture to manage distributed builds. The machine where we install Jenkins software will be Jenkins master and that run’s on port 8080 by default. On the slave machine, we install a program called Agent. This agent requires JVM. This agent executes the tasks provided by Jenkins master. We can launch n numbers of agents and we can configure which task will be run on which agent server from Jenkins master by assigning the agent to the task.

There are multiple ways to Install Agent in this article we will see the following.

  1. Launching Agent with SSH from Master.
  2. Launch Agent by connecting it to master.

Launching Agent with SSH from Master.

For this first we need to install Plugins in Jenkins and Plugin name is

SSH Build Agents plugin
Click on Manage Jenkins
Click On Manage Nodes and Clouds
Click on New Node

Permanent Agent:

Jenkins has two types of agents 1. On-Demand or Dynamic Agent Also called Dynamic Provisioning (Automatically launch when new Job is assigned) 2. Always on or Permanent Agent (Static Agent).

Give Name, permanent Agent, and Click OK
Slave Information
Agent successfully connected and online
Agent is online

Launch Agent by connecting it to master.

Here we will connect windows as a Jenkins slave. for windows, we have to use the JNLP protocol. JNLP(JAVA NETWORK LAUNCH PROTOCOL) is used to connect to Jenkins from a remote location

Click on save
Node Config
ADD Private KEY.ppk format
Connected
Job and Build Console Output

Congratulation, We have successfully build Jenkins Master-Slave Architecture

Follow me for more interesting Blogs.

Thank you for reading!! 😇

Aspiring Cloud DevOps Engineer