Jenkins Server Day28

2 min read

Cover Image for Jenkins Server Day28

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.

Steps to create a Jenkins agent and connect to the Jenkins server

  1. create two EC2 instances: Jenkins-server, Jenkins-agent

    make sure Jenkins, java, and docker are installed on the Jenkins server and Java installed on Jenkins-agent.

  2. run ssh-keygen command to create ssh public and private keys.

  3. create a node on the Jenkins server with launch via SSH and add the SSH private key generated.

  4. make sure to add SSH public key "<public_key>.pub" to ~/.ssh/authorized_keys on the Jenkins-agent.

  5. make sure usage must be only build jobs with matched lable

  6. now if all the configuration is correct it gets connected to the Jenkins-server machine.

  7. Now, create a pipeline with GitHub project enabled and add URL

  8. add pipeline or workflow

  9. save, and build.

Congratulation💕 !! Build a Jenkins Server and Jenkins agent.