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
All CI/CD questions

More on Jenkins