Jenkins Distributed Architecture: In many cases, you require testing your build jobs in different environments, which is not possible to handle it with a single Jenkins server. 

The creation of a heavy project also requires more than a single server, because a single server can’t handle its load.

In that case, we use Jenkins distributes architecture to solve this problem. There are many types of Jenkins distributed architecture. We use Jenkin’s master-slave architecture, mainly to resolve the issue.

In Jenkin’s distributed architecture system, you can run your build jobs on a different operating system like Windows, MacOS, Ubuntu, etc. It also allows you to execute the same test code on different platforms like you can run your same code on Windows and Linux operating system both. Thus, you will save your time in deploying a project.

Jenkins Distributed architecture allows you to add multiple Jenkins slaves under a central (main) Jenkins server. This Jenkins server is also known as Jenkins Master. These Jenkins slaves perform a different task according to the instructions given by the Jenkins server. Jenkins distributed architecture also shows the relationship between Jenkins master and Jenkins slave.

Jenkins Master and Jenkins Slave Relationship Diagram:

Jenkins Distributed Architecture

Jenkins Master:

Your main Jenkins server is Jenkins Mater. Its main work is scheduling the builds job for the Jenkins slaves in the pipeline process. It gives the instructions to Jenkins slaves to perform a particular task in a well-defined way.

Key features of Jenkins Master:

  1. Give instructions to Jenkins slaves.
  2. Keep an eye on the working process of Jenkins slaves.
  3. Create a list of build jobs.
  4. Assign the jibs to the slaves.
  5. Manage the pipeline process.

Jenkins Slave:

A Jenkins slave is a program (contains a set of statements) written in a specific language. It performs all the operations under the control of the Jenkins Master. Jenkins master and Jenkins slave communicate with each other by using the TCP/IP model. Jenkins slave runs on a remote access machine.

Key features of Jenkins Slave:

  1. It takes command from Jenkins Master.
  2. Jenkins slave can be run on any operating system.
  3. It contains a set of instructions (jobs) to be executed.

Its main work is to execute the build jobs and deploy it but as per the command comes from Jenkins master.

Setup of Jenkins master and Jenkins slaves:

Follow the given steps to set up your Jenkins master and slaves in your tool:

Step 1: Go to Jenkins dashboard; in the left panel, you will get the manage Jenkins option.

Step 2: Click on the Manage Jenkins option and scroll down the page and choose the “Manage Nodes and Clouds” option.

Jenkins Distributed Architecture

Step 3: It will take you to the fresh screen having a different option. From here, choose the new mode option. This option will also be available on the left panel of the screen.

Jenkins Distributed Architecture

Step 4: It requires the node name. Provide a name and choose a permanent agent option and proceed.

Jenkins Distributed Architecture

Step 5: Here it asks some information related to the Jenkins slaves like

  1. total number of executors (no. of the jobs),
  2. labels for the slaves,
  3. its usage,
  4. launch method

If the launch method is showing on your computer screen, then

4.1 Go on Jenkins dashboard

4.2 Choose manage Jenkins option

4.3 Go into the configure global security option.

Jenkins Distributed Architecture

4.4. Go into agent section.

4.5. Click on random.

4.6. Then, click on save.

Jenkins Distributed Architecture

5. Give the custom work directory path.

6. Click on save.

Jenkins Distributed Architecture

After completion of all these steps, a new machine node will be created instantly, and it will be in offline mode. If all of the information given by you are correct in the required section, it will come online, else remains in the offline state.

Step 6: Now your slave is running, and you can execute the jobs on it. For the execution with the slave, follow the given steps:

  1. Open your job
  2. Choose the configure option.
  3. Go into the general section of the configuration.
Jenkins Distributed Architecture

4. Click on the checkbox having “Restrict where this project can be run” option, make sure that it is checked.

5. Provide the name of the slave in the label expression section.

Jenkins Distributed Architecture

6. Click on save and after that, build now option,

7. Here, checks your output.

Pin It on Pinterest

Share This