Skip to main content
In distributed Jenkins setups, the controller (master) orchestrates jobs while agents (nodes) execute build steps. This guide shows how to create a permanent Jenkins node and connect an external Ubuntu VM so it can run pipeline stages. In my environment I created a VM named ubuntu-docker-jdk17-node20 to act as a dedicated agent. Example shell prompts:

1. Create the node in the Jenkins UI

Navigate to Manage Jenkins → Manage Nodes → New Node. Give the node a name (I used ubuntu-agent) and choose “Permanent Agent”.
A screenshot of the Jenkins web UI on the "New node" page showing a node named "ubuntu-agent" with "Permanent Agent" selected. The dark-themed page includes a "Create" button to add the node.

2. Configure node details

Fill out the node configuration form. Key fields and recommended values:
A screenshot of a Jenkins "Manage Nodes" configuration page showing node settings like Number of executors (1), Remote root directory (/home/jenkins-agent) and Labels (ubuntu-docker-jdk17-node20). The Usage dropdown is open and set to "Use this node as much as possible."
You can enable monitoring (disk-space threshold, environment variables, tool locations) in the Node properties section. In my example I enabled disk-space threshold monitoring and saved the node. After saving, the node will appear as created but offline until the agent process connects.
Ensure the node’s remote root directory exists or is writable by the user that will run the agent. Jenkins will create subdirectories (for example, remoting, workspaces) under that directory.

3. Download and run the agent on the node VM

On the agent machine, Jenkins provides agent.jar. The UI shows platform-specific launch instructions; the Unix commands below work on most Linux agents.
  • Directly pass the secret on the command line:
  • (Safer) store the secret in a file and reference it:
Requirements and notes:
  • The agent machine must have Java (JRE or JDK) installed. Matching the controller’s major Java version is recommended for remoting compatibility.
  • -workDir is where remoting stores logs and data (e.g., /home/jenkins-agent/remoting).

4. Troubleshooting common connection errors

If the agent cannot connect, the remoting client logs will show errors. A common failure is this 404 when the controller’s inbound TCP agent listener is disabled:
This 404 indicates the controller’s inbound TCP agent listener is disabled (the default for security reasons). To enable JNLP/inbound agents:
  • Go to Manage Jenkins → Configure Global Security → Agents → TCP port for inbound agents.
  • Choose a fixed port or allow a random port.
  • Save and retry the agent run.
A dark-mode browser screenshot of the Jenkins "Manage Jenkins → Security" settings page showing the Markup Formatter set to "Safe HTML" and the Agents section with TCP port options (Fixed selected and a port input field). Save and Apply buttons are visible at the bottom.
Enabling an inbound TCP port allows agents to connect to the controller. Secure this by restricting access with firewalls, VPNs, or IP allowlists and always use the agent secret. Exposing Jenkins’ agent listener to untrusted networks can lead to unauthorized access.

5. Successful connection example

After enabling the TCP listener and running the agent, the remoting logs will show a successful handshake and connection:
On the agent filesystem you will see the agent files and the remoting directory Jenkins creates:

6. Inspect the node in the Jenkins UI

Once online, the node shows additional information and management options in Manage Nodes:
  • Agent configuration history (view and restore previous node configs)
  • Monitoring (JavaMelody) for threads, memory, and processes
  • Node logs and load statistics
  • Actions like disconnect or mark offline
A Jenkins web UI screenshot showing the "Agent Configuration History" page for an "ubuntu-agent" node. The left sidebar lists node actions (Delete Agent, Configure, Build History) and a table shows a config entry by user "siddharth."
A screenshot of the Jenkins web UI showing the "JavaMelody Monitoring" page for an "ubuntu-agent" node. The page lists system reports (View Threads, OS Processes, Memory histogram, MBeans) and system actions (execute garbage collector, generate a heap dump) with left-side navigation.
Example console info when the agent is connected:

Next steps and references

  • Target pipeline stages to this node by its label in a declarative pipeline:
Useful links: You can now use this node to run builds and pipeline stages targeted by label.

Watch Video