You now have Jenkins installed and have seen its dashboard for the first time. Before creating jobs, it is worth understanding how it is organized internally: who decides what runs, where it runs and how the work is shared out. These concepts (controller, agents, executors, labels, queue and workspaces) come up constantly in the interface, in error messages and in Jenkinsfiles. Understanding them from the start will save you a lot of confusion and will let you design a secure, scalable installation. We will finish by applying all of this to how TecnoShop's installation will look as the course progresses.

Architecture Overview

Jenkins follows a distributed model with a central coordinator and several machines that do the work:

flowchart TB
    U["Users<br/>(browser)"] --> C
    G["GitHub<br/>(tecnoshop/orders-api)"] -->|"events / polling"| C
    subgraph C["Jenkins controller"]
        UI["Web interface and API"]
        Q["Build queue"]
        P["Plugins"]
        H[("JENKINS_HOME<br/>configuration and history")]
    end
    C -->|"assigns builds"| A1["Linux agent<br/>2 executors"]
    C -->|"assigns builds"| A2["Windows agent<br/>1 executor"]
    C -->|"creates on demand"| A3["Ephemeral agent<br/>(container)"]

How to read the diagram:

  • Users and external systems (such as GitHub) only talk to the controller.
  • The controller contains the web interface, the build queue, the plugins and the data (JENKINS_HOME).
  • Agents are the machines that actually run the builds. Each one has one or more executors.
  • Some agents are always available, while others are created only when needed.

In Jenkins, both the controller and the agents are generically called nodes. You will see this word in the Manage Jenkins → Nodes menu.

The Controller

The controller is the central Jenkins process: the one you installed in the previous lesson. Its responsibilities are:

Responsibility What it involves
Web interface and API Serves the dashboard you see in the browser, the REST API and the CLI.
Configuration management Stores the definitions of jobs, users, credentials and nodes in JENKINS_HOME.
Build scheduling Decides when a build should run: because of a change in Git, a time-based schedule, someone clicking a button...
Queue management Maintains the list of pending builds and assigns them to free executors.
Orchestration In pipelines, interprets the Jenkinsfile and sends each step to the corresponding agent.
Result storage Receives and stores the console output, the final status, test reports and artifacts.
Plugin management Loads the plugins, which extend everything above.

The controller is the brain of Jenkins. If it goes down, no build can be started or viewed, which is why it must be protected and not overloaded.

Agents

An agent is a machine (physical, virtual or a container) that connects to the controller and runs the builds the controller assigns to it. A small Java process (agent.jar) runs on the agent and receives instructions from the controller.

Why not run everything on the controller? Because agents provide:

  • Isolation: a build can run any command. If that command eats up all the memory, deletes files or contains malicious code, it is better for that to happen on an expendable machine than on the server that holds the entire configuration.
  • Scaling: if the team grows and there are more concurrent builds, you simply add agents.
  • Different platforms and tools: one project may need Windows, another macOS to build iOS apps, another a GPU or a specific Node.js version. Each agent can have the right tools.
  • Controller performance: the controller focuses on coordinating and serving the interface, without competing with builds for CPU and disk.

An important requirement: the agent needs Java to run agent.jar, in addition to the tools your builds use (Git, Maven, Node.js, Docker...).

Executors

An executor is an execution slot: each executor can run one build at a time. A node with 2 executors can run 2 builds simultaneously; if a third one arrives, it has to wait.

Node Executors Possible concurrent builds
Small agent (2 CPUs) 1-2 1-2
Medium agent (4-8 CPUs) 2-4 2-4
Built-in node in production 0 None (recommended)

How many executors should you configure? There is no magic number, but a reasonable starting rule is one executor for every one or two CPUs, adjusted later according to actual usage. Too many executors on one machine make all the builds slow at the same time; too few make the queue grow.

A note on pipelines: when you run a pipeline, the controller internally uses a lightweight (flyweight) executor to interpret the Jenkinsfile, which does not take up any of the configured executors. The steps that do the real work, such as sh './mvnw -B verify', do take up an executor on an agent. This will make more sense in module 3.

The Built-in Node

When you install Jenkins, the controller itself is also configured as a node capable of running builds: this is the built-in node, which in older versions was called "master". By default it has 2 executors.

It is very convenient for getting started, but running builds on it in production is not recommended:

  • Security: a build running on the built-in node runs as the same system user as the controller and has access to its file system, including JENKINS_HOME and its secrets/. A malicious script (for example, in a pull request from an outside contributor) could read credentials or modify the Jenkins configuration.
  • Performance and stability: a heavy build can starve the controller of CPU, memory or disk, slowing down the interface or even bringing all of Jenkins down.
  • Maintenance: loading the controller with build tools (JDK, Node.js, Docker...) makes upgrading it more complicated.

The recommended practice is to configure the built-in node with 0 executors and use agents. Jenkins even shows a warning in Manage Jenkins when it detects builds on the built-in node. In this course we will use it deliberately during the first modules, purely for learning, and stop using it in module 5.

Labels

A label is a word you assign to a node to describe its capabilities: linux, windows, docker, jdk21, gpu... A node can have several labels.

Jobs and pipelines do not usually ask for "agent X", but for "an agent with label Y". That way, if you add another agent with the same label tomorrow, it will start receiving work without changing any job.

Agent Labels
linux-agent-01 linux
linux-agent-02 linux docker
windows-agent-01 windows dotnet

With that configuration:

  • A build that asks for linux can run on linux-agent-01 or on linux-agent-02.
  • A build that asks for linux && docker can only run on linux-agent-02.
  • A build that asks for windows can only run on windows-agent-01.

This is how it is expressed in a pipeline (for illustration only; you will practice it later):

pipeline {
    agent { label 'linux && docker' }
    stages {
        stage('Info') {
            steps {
                sh 'uname -a'
            }
        }
    }
}
  • agent { label 'linux && docker' }: asks for a node that has both labels. You can also use || (or) and ! (not).
  • sh 'uname -a': displays operating system information for the selected agent, which is useful for checking where the build ran.

The Build Queue and Executor Assignment

When something triggers a build, it does not run immediately: it first enters the Build Queue, visible in the side panel of the Jenkins dashboard. The controller continuously checks the queue and assigns each build to a free executor on a compatible node.

This is the complete lifecycle of a build:

sequenceDiagram
    participant D as Trigger<br/>(push, user, schedule)
    participant C as Controller
    participant Q as Build queue
    participant A as Agent (executor)
    D->>C: Requests an orders-api build
    C->>Q: Queues the build
    Note over Q: Waits for: quiet period,<br/>free executor, matching label
    Q->>C: A free executor is available on a valid node
    C->>A: Assigns the build to the executor
    A->>A: Prepares the workspace and fetches the code (git)
    A->>A: Runs the steps (./mvnw -B verify)
    A-->>C: Streams the console output in real time
    A->>C: Returns the result and reports
    C->>C: Stores history and status (SUCCESS, FAILURE...)
    C-->>D: Reports the result (if configured)

Key points of the process:

  1. Trigger: a push to Git, a user clicking Build Now, a time-based schedule or another job.
  2. Queuing: the build waits in the queue. There may be a short quiet period that allows several back-to-back changes to be grouped into a single build.
  3. Assignment: the controller looks for a node that matches the requested label and has a free executor.
  4. Execution: the agent prepares the workspace, fetches the code and runs the steps, sending the output to the controller.
  5. Result: the controller stores the final status and the history, and can send a notification.

If you hover over a build in the queue, Jenkins tells you why it is waiting. Some typical messages:

Queue message Meaning
Waiting for next available executor All compatible executors are busy.
There are no nodes with the label 'linux' No node has that label: a configuration error or an agent that has not been created.
All nodes of label 'linux' are offline The agents exist, but they are disconnected.
In the quiet period The build is in its quiet period before starting.

Workspaces

The workspace is the directory where a build fetches the code and runs its commands. Each job has its own workspace on each node where it runs:

Where the build runs Typical workspace path
Built-in node $JENKINS_HOME/workspace/<job-name>
Agent <agent root directory>/workspace/<job-name>

Important points:

  • The workspace is reused between builds of the same job on the same node (unless it is cleaned), which speeds up builds but can leave leftovers from previous runs.
  • The workspace is not permanent storage: to keep the generated .jar, you have to archive it as an artifact. You will see this in Workspaces, Artifacts and Build History.
  • If two builds of the same job run at the same time on the same node, Jenkins creates separate workspaces by adding a suffix such as @2.

How Agents Connect

For an agent to receive work, a connection must be established between it and the controller. There are two main approaches:

Method Who initiates the connection Requirements When to use it
SSH The controller connects to the agent over SSH, copies agent.jar and starts it. The agent runs an SSH server and the controller has a credential to log in. Linux/Unix agents reachable from the controller. Very common.
Inbound (TCP) The agent connects to the controller on port 50000. The agent can reach the controller; a secret is used for authentication. Agents behind a firewall or on networks the controller cannot reach. Common on Windows.
Inbound (WebSocket) The agent connects to the controller through the regular HTTP/HTTPS port. Only access to the Jenkins URL is needed. When you do not want to open port 50000 or there are proxies in between.

Historically, inbound agents were called JNLP agents (after Java Network Launch Protocol, the technology used to launch them). You will find this term in older documentation and in some image and option names; today the official name is inbound agent.

You will configure these methods step by step in Managing Jenkins Nodes and Agents.

Permanent vs Ephemeral Agents

Characteristic Permanent agents Ephemeral agents (cloud)
Lifecycle Always configured and usually always connected Created when builds are queued and destroyed when they finish
Examples A dedicated server or virtual machine Docker containers, Kubernetes pods, cloud virtual machines
State between builds Keeps workspaces and caches Starts clean every time
Advantages Easy to understand; warm caches, fast builds Full isolation, reproducible environments, scale automatically and do not consume idle resources
Drawbacks They need maintenance; they can accumulate "junk" Slower startup; more pieces to configure

Jenkins manages ephemeral agents through clouds, provided by plugins such as the Docker or Kubernetes ones. At TecnoShop we will start with permanent agents and, in the advanced topics, move on to ephemeral ones.

Plugins as Part of the Architecture

Plugins are not an optional add-on: they are a core part of the architecture. The Jenkins core provides the model for jobs, nodes, the queue and basic security; almost everything else comes from plugins:

  • Git integration (Git plugin): lets you fetch code.
  • Pipeline: a set of plugins that makes the Jenkinsfile possible.
  • SSH Build Agents: connects agents over SSH.
  • Credentials: stores secrets securely.
  • Docker, Kubernetes: provide ephemeral agents.

Plugins run inside the controller, share its memory and can depend on one another. That is why every plugin you install adds capabilities, but also resource consumption, the risk of incompatibilities and attack surface. We will manage them in Using Jenkins Plugins.

Historical Terminology: Master and Slave

Until around 2020, Jenkins called the controller master and the agent slave. The community replaced these terms with controller and agent, and the master node was renamed the built-in node.

Old term Current term In this course
master controller controller
slave agent agent
master node built-in node built-in node
JNLP agent inbound agent inbound agent

If you read a tutorial that talks about "master/slave", it is probably old: check that its instructions are still valid.

TecnoShop's Architecture Throughout the Course

Laura has planned how TecnoShop's Jenkins installation will evolve in three phases, which you will follow during the course:

flowchart LR
    subgraph E1["Modules 1-4"]
        C1["jenkins-controller<br/>built-in node<br/>(builds run here)"]
    end
    subgraph E2["From module 5"]
        C2["jenkins-controller<br/>0 executors"] --> AG["linux-agent-01<br/>label: linux"]
    end
    subgraph E3["Module 8"]
        C3["jenkins-controller"] --> D["Docker agents"]
        C3 --> K["Kubernetes pods"]
    end
    E1 --> E2 --> E3
  1. Modules 1 to 4: a single container, jenkins-controller, which also runs the builds on its built-in node. This is the simplest option for learning, with the caveat that it is not recommended in production.
  2. From module 5: the permanent agent linux-agent-01 with the linux label is added, the controller drops to 0 executors and the pipelines use agent { label 'linux' }.
  3. Module 8: ephemeral agents arrive, in Docker containers and Kubernetes pods.

Common Mistakes and Tips

  • Running everything on the built-in node "because it works": it works until a build eats up the controller's memory or a script reads the secrets. As soon as you move beyond a test environment, use agents.
  • Labels that do not exist or are misspelled: if a build asks for Linux and the agent has linux, it will sit in the queue forever with There are no nodes with the label. Labels are case-sensitive.
  • Too many executors per agent: more executors do not mean more speed if the machine does not have the CPU and memory for all of them.
  • Treating the workspace as permanent storage: the workspace can be deleted at any time; archive anything you want to keep.
  • Forgetting Java on the agent: without Java, agent.jar cannot run and the agent will never connect.
  • Tip: when a build does not start, look at the queue first. The message it shows usually points straight to the problem.

Exercises

Exercise 1. You have these nodes:

Node Executors Labels
built-in 0 —
agent-a 2 linux jdk21
agent-b 1 linux docker
agent-c 1 windows

State which nodes can run a build that asks for: (a) linux, (b) linux && docker, (c) windows || docker, (d) jdk21 && docker. What is the maximum number of builds with the linux label that can run at the same time?

Exercise 2. An orders-api build has been sitting in the queue for ten minutes with the message All nodes of label 'linux' are offline. Explain what it means and what you would check.

Exercise 3. In your own words, explain to Diego, who wants to "save on agents" in the production Jenkins, at least two reasons not to run builds on the built-in node.

Solutions

Solution 1.

  • (a) linux: agent-a and agent-b.
  • (b) linux && docker: only agent-b.
  • (c) windows || docker: agent-c and agent-b.
  • (d) jdk21 && docker: none. The build would stay in the queue, reporting that there are no nodes with that label.

Concurrent linux builds: agent-a provides 2 executors and agent-b provides 1, so 3 at most. The built-in node does not count because it has 0 executors.

Solution 2. There are nodes with the linux label, but all of them are disconnected, so no executor is available. I would check the status of those agents and the reason for the disconnection in Manage Jenkins → Nodes: that the machine is powered on, that there is network connectivity between the controller and the agent, that the SSH credential or the inbound agent's secret is correct, that the agent has Java, and that it has not been manually marked as offline (for example, because of low disk space).

Solution 3. The main reasons: (1) security: the build runs as the controller's user and can access JENKINS_HOME and its secrets/, so a malicious script or a mistake could leak credentials or damage the configuration; (2) stability and performance: a heavy build consumes the controller's CPU, memory and disk and can slow Jenkins down or bring it down for the whole team; (3) maintenance: it forces you to install build tools on the controller, which makes upgrading it more complicated.

Conclusion

Jenkins is organized around a controller that serves the interface, stores the configuration, manages the queue and orchestrates the builds, and agents that do the work on their executors. Labels let you request capabilities instead of specific machines, workspaces are temporary working directories, and plugins are a core piece that lives inside the controller. You also know why the built-in node should not run builds in production and how TecnoShop's installation will evolve. With this mental map you are ready to set up your lab environment: in the next lesson, The Course Project: Repository and Lab Environment, you will create the orders-api repository and bring up jenkins-controller with Docker Compose.

© Copyright 2026. All rights reserved