Skip to content

Latest commit

 

History

History
143 lines (75 loc) · 7.01 KB

clmv2rok300030amjdw0s6ffu.md

File metadata and controls

143 lines (75 loc) · 7.01 KB
title datePublished cuid slug ogImage tags
Day 28 Jenkins Master & Agents
Fri Sep 22 2023 20:49:19 GMT+0000 (Coordinated Universal Time)
clmv2rok300030amjdw0s6ffu
day-28-jenkins-master-agents
cicd-cjy1vtdk2005kjjs17n8couc3, devops-articles, jenkins-devops, 90daysofdevops

What is Jenkins Master (Server):

![Jenkins Configure Master and Slave Nodes | Medium](https://miro.medium.com/v2/resize:fit:526/0*VPFW83hEmFs_oSSh align="center")

In Jenkins, a "master" refers to the central server in a Jenkins automation setup. It is the core component responsible for managing and coordinating the entire Jenkins environment. The master server:

  1. Manages jobs: It schedules and executes jobs or tasks as defined in Jenkins pipelines and projects.

  2. Distributes work: If configured with multiple agents or nodes, the master distributes tasks to these agents for parallel execution.

  3. Provides the web interface: The Jenkins master hosts the web-based user interface where users can configure jobs, view build results, and manage Jenkins settings.

  4. Controls security: It manages user authentication, authorization, and access control for Jenkins.

  5. Logs and monitors: The master records build logs and provide monitoring and reporting capabilities for the entire Jenkins system.

What is Jenkins Agent?

![Day 28 Task: Jenkins Agents](https://media.licdn.com/dms/image/D5612AQEe_Dr85qfUjg/article-cover_image-shrink_600_2000/0/1679232147261?e=2147483647&v=beta&t=5Q50c1dFbGCjCTPD5J7dMtAGUw2amVlP0KTwBJ88yYU align="center")

In Jenkins, an "agent" (also known as a "node" or "slave") is a worker machine that carries out tasks and builds as directed by the Jenkins master. Agents are used to distribute and parallelize work in Jenkins automation pipelines. Here's what agents do:

  1. Execution of Jobs: Agents are responsible for executing jobs or tasks that are defined in Jenkins pipelines or projects. When a job is scheduled for execution, the master assigns it to an available agent.

  2. Parallelization: Agents allow Jenkins to perform multiple tasks concurrently. For example, if you have several builds or tests to run, each can be assigned to a separate agent, speeding up the overall process.

  3. Diversity of Environments: Agents can run on different machines with various operating systems, software configurations, and hardware specifications. This allows Jenkins to support a wide range of build and test environments.

  4. Isolation: Agents provide isolation between different builds or jobs. This isolation ensures that one failing build or job doesn't affect others running on different agents.

  5. Scalability: Jenkins can be set up with multiple agents, allowing you to scale your automation infrastructure as needed. You can add or remove agents to handle varying workloads.

Task-01:

Establish an agent by configuring a node within Jenkins

Add details to add a second node, accordingly.\

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693010539139/148bbcbb-9076-472f-b6e8-eaf062858c31.png?auto=compress,format&format=webp align="left")

step 9: Add Credentials >> kind: SSH with private_key & enter the details accordingly.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693010922041/ae4b63aa-17c6-4b78-a7a1-e33e5e70be19.png?auto=compress,format&format=webp align="left")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693010947091/98ca01cb-2bc3-4491-854c-e1e03bf8452f.png?auto=compress,format&format=webp align="left")

To enter the private_key, In Jenkin-Master:

cd /home/ubuntu/.ssh/
ls
cat id_rsa
copy private key

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693010985694/2dd6f377-fab9-40e4-bf1b-7cdf376995c5.png?auto=compress,format&format=webp align="left")

Copy & Paste the Private_key

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693011003320/5682b35d-6387-4d3b-917a-8c13784f2f01.png?auto=compress,format&format=webp align="left")

Connection is successful

Task-02

  • Run your previous Jobs (which you built on Day 26, and Day 27) on the new agent

  • Use labels for the agent, your master server should trigger builds for the agent server.

Now build a job, here restrict the job to the particular agent.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693011643254/fcea3cd1-1061-4bde-96ae-fa1aef749353.png?auto=compress,format&format=webp align="left")

Build Now

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693011595598/84eda24d-daae-4ac1-aa2a-4086d2fef45c.png?auto=compress,format&format=webp align="left")

Output :

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1693011773627/b59b4cef-27bb-4a50-be48-478c8883b55a.png?auto=compress,format&format=webp align="left")

So I encourage you to try this on your own and let me know in the comment section about your learning experience

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.

Happy Learning 😊🙌

Thank You! Stay Connected ☁️👩‍💻🌈

Contact me at :

LinkedIn: Akash Singh

linkedin.com/in/akash-singh-48689a176

E-mail: [email protected]