docker jenkins配置节点报错:/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/

docker jenkins配置节点报错:

在这里插入图片描述

SSHLauncher{host='59.110.171.91', port=22, credentialsId='47519b09-3e72-47d1-ae7c-16148538e2ca', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[01/05/22 17:50:15] [SSH] Opening SSH connection to 59.110.171.91:22.
/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/jenkins_home/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it.
Key exchange was not finished, connection is closed.
SSH Connection failed with IOException: "Key exchange was not finished, connection is closed.", retrying in 15 seconds. There are 10 more retries left.

解决办法:
ssh-keygen配置证书,三次回车

[root@bogon ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dOVo3O2Iz9RQ4c/nTdgIjrwznDAUU2S6q/kCS6n8tPs root@bogon
The key's randomart image is:
+---[RSA 2048]----+
|        oo+ . o. |
|         * = +   |
|        + = = o  |
|       o = + * * |
|     .  S + + = *|
|    +    = *   oo|
| . o.o  . * o   o|
|  o....o   o     |
|   .+oEo.        |
+----[SHA256]-----+

ssh连接slave机ip,自动生成known_hosts文件

# 连接slave机ip
[root@bogon ~]# ssh 192.168.111.129
The authenticity of host '192.168.111.129 (192.168.111.129)' can't be established.
ECDSA key fingerprint is SHA256:M5BalHyNXU5W49c5/9iZgC4Hl370O0Wr/c5S/FYFIvw.
ECDSA key fingerprint is MD5:28:23:b8:eb:af:d1:bd:bb:8c:77:e0:01:3c:62:7a:cb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.111.129' (ECDSA) to the list of known hosts.
root@192.168.111.129's password: # 输入登录账户密码
Last login: Wed Jan  5 16:10:37 2022 from bogon

[root@bogon ~]# cd .ssh/
[root@bogon .ssh]# ll
总用量 12
-rw-------. 1 root root 1675 15 16:09 id_rsa
-rw-r--r--. 1 root root  392 15 16:09 id_rsa.pub
-rw-r--r--. 1 root root  177 15 16:10 known_hosts

给known_hosts文件赋予可700权限

[root@bogon .ssh]# chmod 700 known_hosts 
[root@bogon .ssh]# ll
总用量 12
-rw-------. 1 root root 1675 15 16:09 id_rsa
-rw-r--r--. 1 root root  392 15 16:09 id_rsa.pub
-rwx------. 1 root root  177 15 16:10 known_hosts

在挂载的/home/wyt/jenkins_home目录下创建.ssh目录,并设置权限

mkdir /home/wyt/jenkins_home/.ssh
chown -R 1000:1000 /home/wyt/jenkins_home/.ssh

/root/.ssh/known_hosts文件复制到/home/wyt/jenkins_home/.ssh目录下,并设置权限

cp /root/.ssh/known_hosts /home/wyt/jenkins_home/.ssh
chown -R 1000:1000 /home/wyt/jenkins_home/.ssh/known_hosts
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值