Nodes, Agents, Labels, Executors, Workspaces, Offline Causes, and Agent Capacity Design: Concepts, Architecture, and Mental Model
Model Jenkins execution capacity explicitly: a queued task becomes runnable only when its requirements match an online eligible node with a free executor, then Jenkins allocates a workspace and releases capacity after the work ends.
Learning objectives
- Distinguish controller, node, agent, executor, label, queue item and workspace without treating them as synonyms.
- Trace a queued task from requirements through node eligibility, executor allocation, workspace use and executor release.
- Inspect node names, labels, online/offline state, executor occupancy and workspace identity before changing capacity.
- Explain why label design and agent placement are security/trust decisions as well as performance decisions.
- Use queue and host evidence instead of executor-count guesswork.
1. The practical problem: “Why is my build waiting?”
After Chapters 9–16, a Jenkinsfile can be valid, credentials can be scoped correctly, and every build step can still sit in the queue. Jenkins must decide where work may run. That decision combines job/Pipeline requirements, labels, node state, usage restrictions and currently available executors.
A useful capacity model therefore starts before an agent executes a command. Preserve the queue item and its reason first. A waiting task may have no matching node, a matching node may be offline, every matching executor may be busy, or policy may forbid the job from the otherwise-capable node.
2. Mental model: requirements become capacity
flowchart TD
A[Queued task + label requirements] --> B[Evaluate eligible nodes]
B --> C{Eligible online node?}
C -- no --> D[Remain queued with reason]
C -- yes --> E{Free executor?}
E -- no --> F[Wait for matching capacity]
E -- yes --> G[Allocate executor + workspace]
G --> H[Run Pipeline/Freestyle work]
H --> I[Record result/evidence]
I --> J[Cleanup policy + release executor]
The queue item is controller state. Labels and node configuration are controller-managed scheduling metadata. The agent process and tools live on the execution host. An executor is a Jenkins scheduling slot on that node. The workspace is a filesystem location allocated in that node context. None of these are interchangeable.
3. Node, agent and executor are different things
| Concept | What it means | Evidence to capture |
|---|---|---|
| Controller | Orchestrates queueing, configuration, web/API requests and build records | Core/Java version, queue item, job/build identity |
| Node | A Jenkins-configured execution computer abstraction, including the built-in node | Name, labels, usage mode, monitors, executor count |
| Agent | The process on a node that communicates with the controller and executes work | Connection state/log, Java/OS/architecture, launcher |
| Executor | A concurrency slot; one executor can run one schedulable task at a time | Busy/idle state and assigned build |
| Workspace | Filesystem context allocated for a job/Pipeline on a node | WORKSPACE, owner, cleanup/reuse state |
4. Labels express eligibility, not capacity
A label says what an agent represents: linux,
arm64, jdk21, high-memory,
release-trusted. A Pipeline can require
linux && jdk21. The node step
supports !, &&, ||,
implication -> and equivalence
<-> expressions. Wildcards and regular
expressions are not label matching syntax.
Eligibility does not mean available capacity. Ten online agents may
all match linux, yet if all matching executors are busy
the task still waits. Conversely, adding executors cannot help when
no node matches the expression.
5. Online, offline and temporarily offline
An agent can be disconnected because its process/network/launcher failed, or an administrator/monitor can make the node unavailable with a recorded offline cause. Temporarily taking a node offline is a scheduling mutation: existing work may need separate handling, while new work will not be assigned there.
Node monitors can observe disk space, temporary space, swap, clock synchronization and response time. A node that crosses configured thresholds may be taken offline. Preserve the cause; “agent offline” is not equivalent to “queue starved because all executors are busy.”
6. Workspaces are execution state, not durable evidence
Workspace paths live on agents and can be reused. Concurrent executions may receive alternate workspace paths such as suffix variants. A build that depends on an old workspace file without recreating or validating it is not reproducible.
Archive durable evidence, publish reports and use controlled caches. Clean or isolate workspaces according to trust and correctness needs. Never assume that a workspace disappearing means the build record or archived artifact should disappear, and never assume a successful workspace cleanup revokes a credential already exfiltrated elsewhere.
7. Capacity is also a trust design
Labels are often capability labels, but some capabilities imply
privilege: signing keys, production network access, hardware devices
or release credentials. Do not schedule untrusted pull-request code
onto the same persistent agent that handles privileged release work
merely because both are linux.
Use distinct pools and source/authorization boundaries. Treat the agent host, OS identity, launcher, installed tools, co-located workloads and workspace/cache policy as part of the security context.
8. Read-only inspection before tuning
// Evidence produced by an ordinary Pipeline on an agent
node('linux-ci') {
echo "node=${env.NODE_NAME}"
echo "labels=${env.NODE_LABELS}"
echo "workspace=${env.WORKSPACE}"
sh 'uname -a || true'
sh 'java -version 2>&1 | head -n 2'
}
Also inspect Manage Jenkins → Nodes, each node's executor occupancy, connection/offline cause, and the build queue. If using the authenticated Remote API in your disposable lab, keep the API token in an environment variable and capture only non-secret JSON fields.
curl -fsS -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
"$JENKINS_URL/queue/api/json?tree=items[id,why,task[name,url]]" | jq .
curl -fsS -u "$JENKINS_USER:$JENKINS_API_TOKEN" \
"$JENKINS_URL/computer/api/json?tree=computer[displayName,offline,temporarilyOffline,numExecutors,busyExecutors,assignedLabels[name]]" | jq .
9. Keep the built-in node out of the worker pool
Jenkins documentation recommends setting the built-in node executor
count to 0 once agents exist. Build code otherwise runs
in the controller trust boundary and can contend with controller
CPU, heap and filesystem operations.
If the lab has only one physical computer, separate agent processes
can still run under different OS identities with no read/write
access to JENKINS_HOME and no privilege escalation.
That improves isolation compared with running builds inside the
controller process, though it is not equivalent to separate hosts.
Knowledge check
Answer before revealing the explanation.
1. What must be true before a queued task can start on an agent?
Its label/node requirements must match an eligible online node, that node must permit the job, and at least one executor must be free. Tool, workspace and trust requirements must also be valid once execution begins.
2. Why is an executor not the same thing as a CPU core?
An executor is a Jenkins concurrency slot. The host still has finite CPU, memory, disk and I/O, so increasing executors can increase contention and make every build slower or less reliable.
3. Why should the built-in node normally have zero executors?
Build code on the built-in node shares the controller process/filesystem trust boundary. Keeping execution on agents improves controller isolation, stability and scalability.
4. What is the difference between an agent label and a trust boundary?
A label is scheduling metadata. It only becomes a trustworthy boundary when administrators control label assignment, node configuration, job permissions and which source is allowed to target that pool.
5. Can a successful build prove the chosen executor capacity is healthy?
No. A single successful build says little about queue delay, host saturation, interference, workspace isolation or peak demand. Capacity needs repeated queue/utilization/resource evidence.
Official references and version notes
-
Jenkins LTS changelog
and
Java support policy
— lab baseline
Jenkins 2.568.3 LTS, Java 21; this LTS line supports Java 21 and 25. - Managing Nodes — controller, node, agent, executor and node-monitor concepts.
- Using Jenkins agents — labels, executor counts, usage modes and distributed builds.
-
Controller Isolation
— do not run builds on the built-in node; set its executor count
to
0once agents exist. - Securing Builds — isolate builds and separate trust domains instead of treating every shared agent as equivalent.
-
Pipeline: Nodes and Processes step reference
—
node,ws, workspace context and supported label-expression operators. -
Pipeline: Nodes and Processes plugin
— baseline
1479.v56e587f413a_7, requires Jenkins 2.479.3 or newer. -
SSH Build Agents plugin
— optional launcher baseline
3.1097.v868116049892; use verified host keys and least-privilege agent accounts. -
Built-In Node Name and Label Migration
— terminology and
NODE_NAME/NODE_LABELSbehavior.
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.