DEV Community

Wycliffe A. Onyango
Wycliffe A. Onyango

Posted on

100 Days of DevOps: Day 75

Jenkins Agent Node Configuration

Project Goal

The primary goal was to successfully connect three Linux Application Servers (stapp01, stapp02, stapp03) as permanent Jenkins agent nodes to the Jenkins controller using the SSH method.

Final Status

SUCCESS. All three agent nodes (App_server_1, App_server_2, and App_server_3) are now online, connected to the Jenkins controller, and ready to accept build jobs.

Prerequisite

Step Action
Install SSH Plugin Navigate to Manage Jenkins then Manage Plugins then Available Plugins. Search for and install the "SSH Agents plugin" (or similar, depending on Jenkins version/naming).

Core Jenkins UI Configuration (Per Node)

The following settings were applied when creating each new permanent node in Jenkins (Manage Jenkins then Manage Nodes then New Node).

1. Credentials Setup

Before configuring the node, the SSH credentials for each agent user were added to Jenkins.

  1. Navigate to Manage Jenkins then Credentials
  2. Click Add Credentials.
  3. Set Kind to Username with private key (or SSH Username with password).
  4. Input the Username (tony, steve, or banner).
  5. Provide the corresponding Private Key (or Password).
  6. Assign an easily identifiable ID (e.g., tony-ssh-key). This ID is selected during node configuration.

2. Node Configuration Table

Configuration Field App_server_1 (stapp01) App_server_2 (stapp02) App_server_3 (stapp03)
Node Name App_server_1 App_server_2 App_server_3
Remote Root Directory /home/tony/jenkins-agent /home/steve/jenkins-agent /home/banner/jenkins-agent
Labels stapp01 stapp02 stapp03
Launch Method Launch agent via SSH Launch agent via SSH Launch agent via SSH
Host stapp01 (or its IP address) stapp02 (or its IP address) stapp03 (or its IP address)
Credentials Select the tony credential ID Select the steve credential ID Select the banner credential ID
Host Key Verification Strategy Non-verifying Verification Strategy (or preferred method) Non-verifying Verification Strategy Non-verifying Verification Strategy
Usage Only build jobs with label expressions matching this node Only build jobs with label expressions matching this node Only build jobs with label expressions matching this node

Key Challenge Resolution: Java 21 Configuration Steps

The initial failure was due to the Jenkins SSH agent session failing to find the correct Java executable. The resolution involved guaranteeing that Java 21 was explicitly set up for the system and the agent users on all three App Servers.

Install Java 21:

    sudo yum install java-21-openjdk -y 
Enter fullscreen mode Exit fullscreen mode

Final Step: Agent Launch

With all environment and Jenkins configurations complete, the nodes were successfully launched from the Jenkins UI, resolving the original dependency and credential errors, and transitioning all agents to an Online status.

general
one
two
three

Top comments (0)