Game Tech Tutorial
Published in

Game Tech Tutorial

How to Setup Master and Slave Architecture using Jenkins? (CI/CD)

Jenkins is an essential tool to run CI/CD pipelines for your projects.

However, if you have more and more pipelines running in single Jenkins, you may encounter some problems in availability and scalability.

Given that one Jenkins can cause a single point of failure problem and longer building time when executing the increasing number of CI/CD pipelines.

How to set up a superior architecture to resolve these problems?

You can set up master and slave architecture for Jenkins.

In this post, we will explore

  • Master-Slave architecture of Jenkins
  • Advantages of using Master-Slave architecture in Jenkins
  • 2 Steps to setup Slaves with Jenkins Master

Master-Slave architecture of Jenkins

This architecture is composed of two components — one master and multiple slaves below.

Master Jenkins:

  • Can define the jobs and assign which slave machine to actually execute the pipelines.
  • Requires to set up the connection to a slave beforehand via SSH in TCP.
  • Needs to save pipelines.

Slave Jenkins:

  • does not need to save jobs or pipelines.
  • requires to keep the same environment configuration as the master.
  • can be hosted on a different OS for your needs.

For instance, a developer makes any code change in PR to Github, Github will notify Jenkins Master via webhook.

Then Jenkins Master can assign a slave Jenkins to run a specific pipeline such as building games for Android on Slave-Win and iOS on Slave-Mac to speed up your workflow.


  • If you don't know how to set up a pipeline from the ground up in Jenkins, refer to the tutorial below.

Advantages of Master-Slave architecture in Jenkins


  • Jenkins Slave can achieve high availability while Jenkins Master can’t.
  • If one of Jenkins's slave machines goes down, Jenkins master will automatically find an available one.
  • Be careful that Jenkins Master may go down if having no standby server to take over.
  • Of course, it’s recommended to set up two masters (master-standby)and multiple salves when needed.


  • It’s simple to scale capacity to ensure the same performance by adding a new Jenkins slave.

2 Steps to setup Slaves with Jenkins Master

Step1: Add a Jenkin Slave to Jenkins Master

  • Log in to Jenkins Web
  • Go to Manage Jenkins → Manage Nodes and clouds → Click New Nodes
  • Fill in the following

Name: <Your name >

Description: <Your description >

Remote root directory: <Jenkins Folder’s Path>

Label: <Your Jenkins Place Label>

Usage: Select Only build jobs with label expression matching this node

Launch method: Choose Launch agent via SSH

Host: <Jenkins Slave IP>

Host: Credentials: <Create a credential Jenkins Slave Username and Password>

  • Then click the Save button.


  • Labels are used for Jenkins Master to assign which Jenkins Slave to run CI/CD.
  • Remember you need to check the slave node’s connection status is fine or not on the dashboard.
  • If not, check the logs to debug.

Step2: Specify Slave Label in Pipeline

Once you have a slave node ready, you can specify Jenkins Slave’s label below to allow your pipeline to execute CI/CD on a specific Jenkins Slave.

If you use a free-style project to create jobs (not pipeline), you can check in Restrict where this project can be run and specify your Jenkins Slave Label in Label Expression.

That’s all. With only two steps you can set up a master and slave architecture for Jenkins.


In this post, you should have learned how to set up the master-slave architecture for your Jenkins and know the benefits of utilizing this architecture.

I hope this post can be helpful for you to ensure the high availability and scalability of your CI/CD backends.

If you liked this story, please show your support by 👏 this story or subscribe to our email to get the latest tutorials in the future.

Thank you for reading!

You might be interested in




High-quality technical tutorials: AWS, GCP, Unity, SDK, Security, and more.

Recommended from Medium

Empathetic and Behavioral Design with AI at maslo Partners With Decentr To Provide Crosschain Cloud Services

Eventual Consistency Design Pattern

Concurrent Scalping Algo Using Async Python

Qomtum Qomputing L1 (a call)

Daily progress: Creating a UIManager

Bootstrap & Miller Circuit

21 days of Code with Code Warriors — Day 6

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Wei

Eric Wei

Senior Full Stack Engineer & Solution architecture | AWS, GCP | Cloud, Unity Game Development, SDK, DevOps, and more.

More from Medium


How to Setup CI/CD Pipeline with Jenkins and Unity Test Runner? (Complete Tutorial)

Some tips that may help you with Jenkins on Pipeline-as-Code

A funny Jenkins logo

Containerization of java app project using Docker