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 1月 5 16:09 id_rsa
-rw-r--r--. 1 root root 392 1月 5 16:09 id_rsa.pub
-rw-r--r--. 1 root root 177 1月 5 16:10 known_hosts
给known_hosts文件赋予可700权限
[root@bogon .ssh]# chmod 700 known_hosts
[root@bogon .ssh]# ll
总用量 12
-rw-------. 1 root root 1675 1月 5 16:09 id_rsa
-rw-r--r--. 1 root root 392 1月 5 16:09 id_rsa.pub
-rwx------. 1 root root 177 1月 5 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