jenkins连接从节点失败

2022/9/6 9:18
第一次启动节点时可能会连不上服务器:

Warning: no key algorithms provided; JENKINS-42959 disabled
SSHLauncher{host='xxx.xxx.xxx.xxx', port=22, credentialsId='xxx.xxx.xxx.xxx', jvmOptions='', javaPath='/home/user/java/jdk1.8.0_261/bin/java', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=false, trackCredentials=true}
[09/06/22 09:13:30] [SSH] Opening SSH connection to xxx.xxx.xxx.xxx:22.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:13:30] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:13:45] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 9 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:14:00] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 8 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:14:15] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 7 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:14:30] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 6 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:14:45] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 5 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:15:00] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 4 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/user/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/user/.ssh/known_hosts
[09/06/22 09:15:15] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 3 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/jcf/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/jcf/.ssh/known_hosts
[09/06/22 09:15:30] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 2 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/jcf/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/jcf/.ssh/known_hosts
[09/06/22 09:15:45] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
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 1 more retries left.
Searching for xxx.xxx.xxx.xxx in /home/jcf/.ssh/known_hosts
Searching for xxx.xxx.xxx.xxx:22 in /home/jcf/.ssh/known_hosts
[09/06/22 09:16:00] [SSH] WARNING: No entry currently exists in the Known Hosts file for this host. Connections will be denied until this new host and its associated key is added to the Known Hosts file.
Key exchange was not finished, connection is closed.
ERROR: Connection is not established!
java.lang.IllegalStateException: Connection is not established!
    at com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:988)
    at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPasswordAuthenticator.canAuthenticate(TrileadSSHPasswordAuthenticator.java:84)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
    at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:222)
    at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:173)
    at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:886)
    at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:434)
    at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:421)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[09/06/22 09:16:15] Launch failed - cleaning up connection
[09/06/22 09:16:15] [SSH] Connection closed.

解决方式:
手动连接一次服务器,然后将密钥保存一下就行了:

Last login: Mon Sep  5 19:16:16 2022 from xxx.xxx.xxx.xxx
[user@vm-osvm78168-app ~]$ ssh xxx.xxx.xxx.xxx
The authenticity of host 'xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:mm:nn:oo:pp.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
user@xxx.xxx.xxx.xxx's password: 
[user@vm-osvm78168-app ~]$ 
posted @ 2022-09-14 17:48  三点一圆  阅读(594)  评论(0编辑  收藏  举报