A "controller" operating by itself is the basic installation of Jenkins.
The controller handles all tasks for your build system.
In most cases installing an agent doesn’t change the behavior of
the controller. It will serve all HTTP requests, and it can still build
projects on its own. Once you install a few agents you might find
yourself removing the executors on the controller in order to free up controller
resources (allowing it to concentrate resources on managing your build
environment) but this is not a necessary step. If you start to use
Jenkins a lot with just a controller you will most likely find that you will
run out of resources (memory, CPU, etc.). At this point you can either
upgrade your controller or you can setup agents to pick up the load. As
mentioned above you might also need several different environments to
test your builds. In this case using an agent to represent each of your
required environments is almost a must.
An agent is a computer that is set up to offload build projects from the controller.
Once configured, this distribution of tasks is fairly automatic.
The exact delegation behavior depends on the configuration of each
project; some projects may choose to "stick" to a particular machine for
a build, while others may choose to roam freely between agents. For
people accessing your Jenkins system
, things
work mostly transparently. You can still browse javadoc, see test
results, download build results from a controller, without ever noticing
that builds were done by agents. In other words, the controller becomes a
sort of "portal" to the entire Jenkins environment.
Since each agent runs a separate program, there is no
need to install the full Jenkins (package or compiled binaries) on an
agent. There are various ways to start agents, but in the end the agent
and Jenkins controller need to establish a bi-directional communication link
(for example a TCP/IP socket) in order to operate.
Follow the Using Agents instructions to quickly
start using distributed builds.
Controller to agent connections
The most popular ways agents are configured are via connections that are
initiated from the controller. This allows agents to be minimally configured
and the control lives with the controller. This does require that the controller
have network access (ingress) to the agent (typically this is via ssh).
In some cases this is not desirable due to security network rules, in
which case you can use Agent to controller connections via an inbound agent.
Agent to controller connections
In some cases the agent will not be visible to the controller, so the
controller can not initiate the agent process. You can use a different type
of agent configuration in this case called an "inbound agent". This means that the
controller does not need network "ingress" to the agent (but the agent will
need to be able to connect back to the controller). Handy for if the agents
are behind a firewall, or perhaps in some more secure environment to do
trusted deploys (as an example). See the sections below to choose the
type of agent that is most appropriate for your needs.
Choosing agents with labels
As you will see below, agents can be labelled. This means different parts
of your build, or pipeline, can be allocated to run on specific agents
(based on their label). This can be useful for tools, operating systems
or perhaps for security purposes (it is possible to set quite detailed
access rules of what can run where, based on agent configurations). A
server that runs an agent is often referred to as a "node" in Jenkins.