Issue description:
In Jenkins pipelines, leveraging node agents is common for an efficient setup. Whether utilizing Docker images as agents or the master node itself, the configuration of slave nodes can sometimes lead to authentication challenges. This blog addresses the resolution of the “Authentication Failed: Error while configuring the slave node” error in Jenkins.
Scenario:
The appearance of the error suggests a problem with authenticating and configuring a Jenkins agent (slave) to connect with the Jenkins master. Let’s delve into a scenario where, for instance, Jenkins is configured on an “Amazon Linux” EC2 server, and an attempt is made to create a slave node using “Ubuntu” distributions.
Resolution Steps:
Step 1: Ensure consistency in the Access Key (.ppk) used for authentication on both the master and slave servers. Navigate to “Manage Jenkins” > “Nodes” > “(Node Name)” (e.g., agent) > “Configure” in the Jenkins Portal.
Step 2: In the Configure section, verify that the Launch Method is set to “Launch Agents Via SSH.” In the “Credentials” section, add credentials by clicking on the “+” button and selecting Jenkins
Once you click on the Jenkins, it will direct you to the new page as shown in the below image:
Step 3: Choose “SSH Username with private key” as the Kind. Assign a suitable ID and description.
Consider using “root” for the username, given its comprehensive privileges.
And in the Private key section check on Enter directly and add the Private Key(.ppk) file that you used as the access key while authentication to login both the servers.
Add the created credentials. And click on save.
Step 4: After this go to the agent section and click on relaunch agent. Then it will authenticate and connect to the Jenkins master.
Conclusion: Addressing authentication and configuration challenges between Jenkins master and slave nodes is pivotal for a seamless continuous integration and delivery environment. Throughout this blog, we’ve outlined key considerations and practical steps to overcome these issues, fostering an efficient pipeline setup.