Skip to content

how to create a node with a username and password?

0

Hai AWS team, how to create a node with a username and password in the launch agent via SSH (username and password) in the launch method in the slave node. I tried with credentials to the node, but I am getting errors like

Enter image description here

ERROR MESSAGE:

SSHLauncher{host='172.31.35.194', port=22, credentialsId='1428b6e5-99f2-4e2a-ae28-b2fb098d3ac2', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true} [07/17/24 10:30:03] [SSH] Opening SSH connection to 172.31.35.194:22. [07/17/24 10:30:03] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed. [07/17/24 10:30:03] [SSH] Authentication failed. Authentication failed. [07/17/24 10:30:03] Launch failed - cleaning up connection [07/17/24 10:30:03] [SSH] Connection closed.

this is my error message

Enter image description here

please solve my problem.

Thanks in advance

regards

G.v.jeevan kalyan

asked 2 years ago189 views
1 Answer
1
Accepted Answer

Hello,

Please try this solution.

Step 1: Add SSH Credentials in Jenkins

Go to Credentials Management:

  1. Navigate to Manage Jenkins > Manage Credentials.

Add New Credentials:

  1. Select the domain where you want to add the credentials (typically (global)).
  2. Click on Add Credentials.

Fill in the Credential Details:

  1. Kind: Select Username with password.
  2. Username: Enter the SSH username for the agent node.
  3. Password: Enter the corresponding password.
  4. ID: Leave this blank to let Jenkins generate an ID.
  5. Description: Add a description to identify the credentials.
  6. Click OK.

Step 2: Configure the Jenkins Node

Add a New Node:

  1. Go to Manage Jenkins > Manage Nodes and Clouds > New Node.

Configure Node Settings:

  1. Name: Enter a name for your node, e.g., MyAgentNode.
  2. Select Permanent Agent and click OK.

Node Details:

  1. Remote root directory: Enter the path where Jenkins will store files on the agent, e.g., /home/jenkins.
  2. Number of Executors: Enter the number of executors (typically 1).
  3. Labels: Add any labels you need to categorize the node.
  4. Usage: Select Use this node as much as possible or other appropriate option.

Launch Method:

  1. Launch method: Select Launch agents via SSH.
  2. Host: Enter the IP address or hostname of the agent node.
  3. Credentials: Select the SSH credentials you added earlier.
  4. Host Key Verification Strategy: Select Manually trusted key verification Strategy.

Save:

  1. Click Save.

Step 3: Verify and Troubleshoot

Check SSH Access:

  1. Manually test SSH access from the Jenkins server to the agent node using the provided credentials.
ssh username@172.31.35.194

https://www.jenkins.io/doc/book/using/using-credentials/

https://devopscube.com/setup-slaves-on-jenkins-2/#:~:text=Setting%20up%20Jenkins%20Agents%2FSlaves%20using%20username%20and%20password,shown%20in%20the%20image%20below%20and%20save%20them.

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
  • Hai, Thanks for your replay.

    As u said I tired again with the same rules then also I am getting same error.

    Jenkins server

    Enter image description here

    Agent server

    Enter image description here

    Credentials images

    Enter image description here

    New Node images

    Here in root directory I created in ubuntu like ---- /home/ubuntu/app (This is my root directory in agent server)

    Enter image description here

    **Node credentials **

    Enter image description here

    After save that node, I got same error.

    Error message

    Enter image description here

    SSHLauncher{host='172.31.19.146', port=22, credentialsId='6c219c4e-4566-4cda-a602-85997f19292f', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true} [07/18/24 15:58:49] [SSH] Opening SSH connection to 172.31.19.146:22. [07/18/24 15:58:49] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed. [07/18/24 15:58:49] [SSH] Authe

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.