How do inbound (JNLP/WebSocket) and SSH agents connect to the controller?
IntermediateConceptJenkins
Answer
SSH agents: the controller initiates an SSH connection to the agent host, copies agent.jar and starts it. Requires network reach from controller to agent.
Inbound agents: the agent starts java -jar agent.jar and connects to the controller. Two transports exist: the classic TCP port (set a fixed "TCP port for inbound agents") and WebSocket, which tunnels over the normal HTTP(S) port and is easier through proxies and ingress. Inbound is what the Kubernetes plugin uses for pod agents.
java -jar agent.jar -url https://jenkins.example.com/ -name build-01 \
-secret @secret-file -webSocket -workDir /home/jenkins/agent
More on Jenkins
What is Jenkins and how is its architecture organised?BeginnerWhat are executors, nodes and labels in Jenkins?IntermediateWhy should you not run builds on the Jenkins controller?BeginnerWhat is a Jenkinsfile and where does it live?BeginnerDeclarative versus Scripted Pipeline: what are the differences?IntermediateWhat does the `post` section in a declarative pipeline do?Beginner