Course contentsShow
← Cloud and Infrastructure
Lesson 1779 of 2,98937. JenkinsFree lesson

Jenkins Build Agents and Executors

Configure build agents (nodes), manage executor capacity, set labels for job routing, and understand agent connection methods.

Jenkins Build Agents and Executors

You'll learn how to scale Jenkins by distributing builds across multiple machines and control build capacity through agents and executors.

What Are Build Agents?

A build agent (also called a node) is a machine that executes Jenkins jobs. Think of agents like workers in a factory — the Jenkins master (controller) assigns tasks, while agents do the actual building, testing, and deployment work. This separation allows you to scale horizontally and isolate different build environments.

The Jenkins master itself has a built-in node (often with limited executors), but production setups typically use dedicated agents.

Understanding Executors

An executor is a slot for running a single job on an agent. If an agent has 4 executors, it can run 4 jobs simultaneously. Setting the right executor count balances parallelism with resource constraints (CPU, memory). A powerful agent might have 10 executors; a lightweight one might have just 2.

Configuring Agents

Navigate to Manage Jenkins → Manage Nodes and Clouds to add agents. Key configurations:

  • Name: Unique identifier for the agent
  • Number of executors: How many concurrent jobs it can handle
  • Labels: Tags like linux, docker, or production that jobs use to request specific agents
  • Usage: Whether jobs can run on this agent freely or only if explicitly requested

Agent Connection Methods

Jenkins supports several connection approaches:

  • SSH: Master connects to agent via SSH (Linux/Unix)
  • JNLP: Agent initiates connection to master (works through firewalls)
  • Direct: Agent runs as a service, master controls it
  • Cloud agents: Dynamically provisioned (Docker, Kubernetes, EC2)

Labels and Job Routing

Labels are the routing mechanism. When configuring a job, you specify Restrict where this project can run with a label expression like linux && docker. Jenkins then routes the job only to agents matching those labels.

Key Takeaway: Build agents distribute workload across multiple machines, executors control concurrency per agent, and labels enable intelligent job routing — together they form Jenkins' scalability foundation.