How to Add a Jenkins Slave Node (Agent) via SSH
This guide walks through the complete process of adding a Jenkins agent, from creating the node in the Jenkins UI and installing Java and Git on the remote machine to copying SSH keys, verifying connectivity, and testing the agent’s operation.
This article explains how to add a Jenkins slave node (agent) using SSH, covering UI configuration, prerequisite software installation, key transfer, and verification steps.
Step 1 – Add the node: In Jenkins, go to System Management → Node Management , click “New Node”, enter the node name (e.g., jenkis), set the number of executors (e.g., 2), remote root directory (e.g., /var/lib/jenkins), label (e.g., A), and choose the launch method “Launch agents via SSH”. Fill in the agent’s IP address, username, and password, and keep the agent online as much as possible.
Step 2 – Install required software on the agent: Ensure Java and Git are installed. Run the following commands on the agent:
[root@jenkis~]# yum install git -y [root@jenkis~]# yum install java-1.8.0_191-b12- -yStep 3 – Copy the master’s private key to the agent: Transfer the SSH private key from the Jenkins master to the agent:
[root@jenkis~]# scp [email protected]:/root/.ssh/id_rsa /root/.ssh/id_rsaStep 4 – Verify the private key can log into the Git server: Test SSH access: [root@jenkis~]# ssh [email protected] After a successful login you should see a message such as “Last login: … from 192.168.20.182”.
Step 5 – Test the Jenkins node: Use Git commands to ensure the agent can interact with repositories:
git add . # add to local cache git commit -m "first git" # commit locally git push origin master # push to remote repositoryFinally, verify the node appears online in Jenkins and can execute jobs.
--- End of tutorial ---
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
