无法通过jenkins连接到AWS slave

时间:2017-01-31 18:40:00

标签: jenkins ssh amazon-ec2 continuous-integration jenkins-plugins

我试图在jenkins中使用EC2插件配置主从配置。在配置EC2插件之后,jenkins成功启动了slave,我甚至可以ssh到该slave。但是当我查看jenkins中的Node日志时,我发现jenkins无法连接到slave。这就是我所看到的:

This node is offline because Jenkins failed to launch the slave agent   on it. See log for more details
INFO: Authenticating as ubuntu
Jan 31, 2017 6:29:00 PM null
INFO: Connecting to ip-10-226-254-52.ec2.internal on port 22, with timeout 10000.
Jan 31, 2017 6:29:10 PM null
INFO: Failed to connect via ssh: The kexTimeout (10000 ms) expired.
Jan 31, 2017 6:29:10 PM null
INFO: Waiting for SSH to come up. Sleeping 5.
Jan 31, 2017 6:29:15 PM null
INFO: Connecting to ip-10-226-254-52.ec2.internal on port 22, with timeout 10000.
Jan 31, 2017 6:29:25 PM null
INFO: Failed to connect via ssh: The kexTimeout (10000 ms) expired.
Jan 31, 2017 6:29:25 PM null
INFO: Waiting for SSH to come up. Sleeping 5.
ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins
java.lang.NullPointerException
at hudson.plugins.ec2.ssh.EC2UnixLauncher.bootstrap(EC2UnixLauncher.java:309)
at hudson.plugins.ec2.ssh.EC2UnixLauncher.launch(EC2UnixLauncher.java:131)
at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:122)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:253)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

我在网上查了一下但是帮不了多少。如果你们中的任何人都熟悉这种错误,请帮助我。提前谢谢。

1 个答案:

答案 0 :(得分:3)

我想我已经弄明白了。我指定为从属设备使用的安全组没有SSH端口(22)未在主安全组上打开。打开SSH端口后,我可以连接到从节点 注意:我对主服务器和从服务器使用相同的安全组

INFO: Connected via SSH.
Feb 02, 2017 4:29:59 PM null
INFO: connect fresh as root