Problem Statement
How do Jenkins agents connect to the master?
Explanation
Jenkins agents can connect to master through multiple methods. SSH connection is common for Unix/Linux agents where master initiates SSH connection to agent using credentials. This is simple and secure but requires SSH access. JNLP (Java Network Launch Protocol) or Java Web Start allows agents to initiate connection to master, useful when master can't reach agent directly (firewalls, NAT). Agent runs Java process connecting outbound to master.
Windows agents often run as Windows service, and Docker agents can be dynamically provisioned using Docker plugin. Kubernetes plugin can provision agent pods on-demand in Kubernetes clusters. Cloud providers have plugins for provisioning agents on AWS EC2, Azure VMs, or GCP instances dynamically based on build demand.
Agent setup requires Java installed on agent machine, proper network connectivity between master and agent, and correct credentials configured in Jenkins. Master needs to know agent's connection details (hostname/IP, credentials, labels). Agents can have labels for job targeting specific environments (linux, windows, docker, high-memory). Understanding agent connection methods is crucial for distributed Jenkins architectures.
