Controller and Agents
Learn the concepts, configuration, commands, and practical workflow required to use Controller and Agents in a real Jenkins environment.
What is Controller and Agents?
Controller and Agents represent the fundamental operational paradigm of a distributed Jenkins cluster. This structure ensures high availability, security, and parallel processing capabilities across distinct servers.
Jenkins Controller (The Orchestrator)
The management machine dedicated to steering administrative pipelines rather than heavy compute work.
- Hosting the Dashboard: It serves the primary web interface used to create pipelines and inspect logs.
- Job Scheduling: It handles incoming build requests from triggers, hooks, or timed cron operations.
- Workload Dispatching: It analyzes build requirements and sends commands out to available executing nodes.
- Log Aggregation: It saves and streams performance diagnostics and historical build artifacts from execution steps.
Jenkins Agents (The Execution Engines)
Independent runtime instances configured on separate execution targets to perform real physical labor.
- Executing Build Commands: They carry out commands defined inside steps, such as shell scripts or test scripts.
- Platform Diversity: They spin up on diverse targets (Linux, Windows, macOS) to support target-specific application builds.
- Environment Isolation: They store temporary workspace directory checkouts away from the critical system files of the master.
- Connection Adaptability: They link back to the hub securely using SSH connections or Inbound WebSockets (agent.jar).
Key Concepts
Decoupled Execution
Splitting configuration administration away from task execution to keep heavy compilation workloads from freezing the central management dashboard.
Agent Labeling
Using custom labels or tags to match appropriate build stages to matching environments (e.g., dispatching iOS tasks only to a macOS node).
Practical Jenkins Example
The following basic declarative pipeline demonstrates how to target custom node parameters across the cluster setup:
pipeline {
agent { label 'linux-docker-node' }
stages {
stage('Learn Controller and Agents') {
steps {
echo 'Jenkins lesson: Controller and Agents'
}
}
}
}
Practice Exercise
- Open Jenkins and go to Manage Jenkins > Nodes to inspect the configured controller status and worker agents list.
- Create a new pipeline test script using the specific label code block shown in the example above.
- Execute the pipeline build run and monitor the Console Output.
- Verify the specific host line showing which machine node executed the build instructions.
Summary
You have completed the Controller and Agents lesson. Continue through the syllabus to build the Jenkins skills required for real CI/CD automation.