【问题标题】:Jenkins add new node詹金斯添加新节点
【发布时间】:2020-02-13 10:48:05
【问题描述】:

我正在尝试设置 Jenkins 以进行生产部署。目的是让 Jenkins 在生产服务器上执行 git clone、构建和部署等。

Jenkins 在配置管理服务器 (CentOs 7) 上运行,生产服务器是另一台服务器 (Centos 7)。

我首先在 Jenkins 中创建一个新节点,配置如下:

然后我将生产服务器 IP 地址添加到 Jenkins 已知主机,如下所示

-bash-4.2$ cat /var/lib/jenkins/.ssh/known_hosts
192.168.1.xx ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYblabla=

我确认在 Jenkins 帐户下的配置管理服务器上,我可以通过 ssh 连接到生产服务器。

但在 Jenkins 上,节点状态总是这样:

This agent is offline because Jenkins failed to launch the agent process on it.

节点日志是这样的:

SSHLauncher{host='192.168.1.xx', port=22, credentialsId='service account at w', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[02/12/20 20:57:51] [SSH] Opening SSH connection to 192.168.1.xx:22.
[02/12/20 20:57:51] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
ERROR: Server rejected the 1 private key(s) for service_account (credentialId:service_account at webi/method:publickey)
[02/12/20 20:57:51] [SSH] Authentication failed.
Authentication failed.
[02/12/20 20:57:51] Launch failed - cleaning up connection
[02/12/20 20:57:51] [SSH] Connection closed.

任何人都可以帮助解决以下问题:

  1. 我还需要在生产服务器上安装 Jenkins 吗?
  2. 如何配置 Jenkins 以在其上运行管道 新节点?

【问题讨论】:

    标签: jenkins ssh


    【解决方案1】:

    好吧,我终于想通了:

    无需在生产服务器上安装 Jenkins;

    SSH 连接失败的原因是 Jenkins 设置的凭据错误。本质上,Jenkins 将执行 SSH 连接,因此应该使用用户名/密码。所以我所做的是创建一个新的凭据,Jenkins 会将 JAR 文件复制到 /var/jenkins 目录。

    您还需要更改 /var/jenkins 目录的所有权!

    【讨论】:

      猜你喜欢
      • 2018-09-29
      • 2019-12-02
      • 2017-06-22
      • 2018-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      相关资源
      最近更新 更多