Day 28 Task: Jenkins Agents
🔶 Jenkins Master (Server)
Jenkins’s server or master node holds all key configurations. The Jenkins master server is like a control server that orchestrates all the workflow defined in the pipelines. For example, scheduling a job, monitoring the jobs, etc.
🔶 Jenkins Agent
An agent is typically a machine or container that connects to a Jenkins master and this agent executes all the steps mentioned in a Job. When you create a Jenkins job, you have to assign an agent to it. Every agent has a label as a unique identifier.
When you trigger a Jenkins job from the master, the actual execution happens on the agent node that is configured in the job.
A single, monolithic Jenkins installation can work great for a small team with a relatively small number of projects. As your needs grow, however, it often becomes necessary to scale up. Jenkins provides a way to do this called “master to agent connection.” Instead of serving the Jenkins UI and running build jobs all on a single system, you can provide Jenkins with agents to handle the execution of jobs while the master serves the Jenkins UI and acts as a control node.
🔶 Pre-requisites
Let’s say we’re starting with a fresh Ubuntu 22.04 Linux installation. To get an agent working make sure you install Java ( same version as Jenkins master server ) and Docker, Docker-composer on it.
Note:- While creating an agent, be sure to separate rights, permissions, and ownership for Jenkins users.
🔶 Task-01
Create an agent by setting up a node on Jenkins.
Create a new AWS EC2 Instance and connect it to the master(Where Jenkins is installed)
The connection of the master and agent requires SSH and the public-private key pair exchange.
ssh-keygen to the master server as mine is Jenkins-server.
copy the public key of the master to the agent server as mine is Jenkins-agent.
Configure agent node goto Manage Jenkins > manage node and clouds > New Node.
Verify its status under the "Nodes" section.
You can follow this article for the same
🔶 Task-02
Run your previous Jobs (which you built on Day 26, and Day 27) on the new agent.
In the pipeline script add an agent label.Use labels for the agent, your master server should trigger builds for the agent server.
Now check with the agent server ip and use port 8000 to make sure you have added a rule in the security group of the agent server.
In conclusion, setting up Jenkins agents offers a significant advantage in optimizing Continuous Integration and Continuous Deployment (CI/CD) workflows. Agents enable workload distribution, allowing jobs to run in parallel on different machines. This approach not only improves the efficiency of your Jenkins infrastructure but also speeds up build and deployment processes. By strategically configuring agents and distributing tasks, you can enhance resource utilization, accommodate diverse workloads, and achieve seamless scalability. The ability to dynamically allocate tasks to specific agents based on their capabilities further enhances flexibility and responsiveness in your development pipeline. Overall, Jenkins agents play a pivotal role in creating a resilient and high-performing CI/CD environment.
Happy Learning:)
Stay in the loop with my latest insights and articles on cloud ☁️ and DevOps ♾️ by following me on Hashnode, LinkedIn (https://www.linkedin.com/in/chandreshpatle28/), and GitHub (https://github.com/Chandreshpatle28).
Thank you for reading! Your support means the world to me. Let's keep learning, growing, and making a positive impact in the tech world together.
#Git #Linux Devops #Devopscommunity #90daysofdevopschallenge #python #docker #Jenkins
Subscribe to my newsletter
Read articles from CHANDRESH PATLE directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
CHANDRESH PATLE
CHANDRESH PATLE
Hi, I'm Chandresh Patle, an aspiring DevOps Engineer with a diverse background in field supervision, manufacturing, and service consulting. With a strong foundation in engineering and project management, I bring a unique perspective to my work. I recently completed a Post Graduate Diploma in Advanced Computing (PG-DAC), where I honed my skills in web development, frontend and backend technologies, databases, and DevOps practices. My proficiency extends to Core Java, Oracle, MySQL, SDLC, AWS, Docker, Kubernetes, Ansible, Linux, GitHub, Terraform, Grafana, Selenium, and Jira. I am passionate about leveraging technology to drive efficient and reliable software delivery. With a focus on DevOps principles and automation, I strive to optimize workflows and enhance collaboration among teams. I am constantly seeking new opportunities to expand my knowledge and stay up-to-date with the latest industry trends. If you have any questions, collaboration ideas, or professional opportunities, feel free to reach out to me at patle269@gmail.com. I'm always open to connecting with fellow tech enthusiasts and exploring ways to contribute to the DevOps community. Let's build a better future through innovation and continuous improvement!