Jenkins Master Server
Jenkins Master Server is the central control point of a Jenkins Continuous Integration/Continuous Deployment (CI/CD) system. It manages the scheduling of jobs, distributes workloads to Jenkins agents, and stores configurations and plugins. The Master Server receives requests from users, initiates build jobs, and provides real-time feedback on build statuses and overall system health.
Jenkins Agent
Jenkins Agent is a worker node in the Jenkins CI/CD system that executes tasks delegated by the Jenkins Master Server. It allows parallel execution of jobs on multiple machines, improving build efficiency. Agents can run on various platforms, such as Windows, Linux, or macOS, and are responsible for fetching code, building, testing, and deploying applications. Agents communicate with the Master to receive job instructions and report back job results.
Project: Deploy a web app through Jenkins master to Jenkins worker node
Set Up Jenkins-Master & Jenkins-Agent
step1: Create a 2 EC2 instance in AWS and connect both servers and named it
jenkins-master (no. 1 instace)
jenkins-agent (no. 2 instance)
Step 2: Now, enerate SSH key on the jenkins-master using "ssh-keygen" command.
ssh-keygen # Sometime your Master and Agent node failed in Jenkins, so try with ed25519 keygen format. # ssh-keygen -t ed25519 # ed25519 is a keygen format
Now go to that folder and copy the id_rsa.pub which is public key.
cd .ssh ls cat id_rsa.pub
Then on the jenkins-agent server, paste the public key from the jenkins-master in the authorized_keys file.
cd .ssh ls vi authorized_keys
Now from the jenkins-master we can connect the jenkins-agent server
# inside ssh dir ssh ubuntu@<Public-IPv4-addr> # if we exit we will be back to jenkins-server.
Install Java in the agent server.
sudo apt-get update sudo apt-get install openjdk-11-jre #for makesure run this command java --version
Now go to the Jenkins Dashboard and click on Manage Jenkins.
Now click on Manage Nodes & Clouds, and click on "+ New Node"
and follow these blanks:
Now click "OK" and Node will be connected and online.
Your agent is sucessfully built.
For another Jenkins project.
Follow me on LinkedIn to see interesting posts like this : )