Day 28 Task: Jenkins Agents

Day 28 Task: Jenkins Agents

Jenkins Master (Server)

Jenkins’s server or master node holds all key configurations. 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 that actually execute 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.

Task-01

  • Create an agent by setting up a node on Jenkins

  • Create a new AWS EC2 Instance and connect it to master(Where Jenkins is installed)

  • The connection of master and agent requires SSH and the public-private key pair exchange.

  • Verify its status under "Nodes" section.

Step1:Created Jenkins Agent server:

Step2:Generated keys by ssh-keygen

Step3:Move to Agent server-

vim authorized_key and save public key in agent server

Step4:once above step completed make sure if both servers connected

ssh ubuntu@ip of the host server

Once these servers connected.

Step5:Login to Jenkins-Manage Jenkins-

Step6:Create new node launch it and verify status it should be in sync.

Step7:SSH key and Credentials configuration:

Host ip and master rsa_pvt key under credentials

Host ip and master rsa_pvt key under credentials and create credentials

Step8:Webhook:Integration between Jenkins and GIT.

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.

Thank you for reading!! Hope you find this helpful.

#day28#90daysofdevops#devopscommunity#

Always open for suggestions..!!