Issue
I'm trying to configure a master-slave configuration using EC2 plugin in jenkins. After configuring the EC2 plugin, jenkins launches the slave successfully and I can even ssh into that slave. But when I look into Node logs in jenkins, I see that jenkins could not connect to slave. Here is what I'm seeing:
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)
I checked through online but couldn't help much. If any of you are familiar with this kind of error, please help me. Thanks in advance.
Solution
I guess I've figured out myself. The security groups which I specified for the slave to use did not have SSH port(22) is not opened on the master's security group. After opening up SSH port I'm able to connect to slave node Note: I'm using same security groups for both master and slave
INFO: Connected via SSH.
Feb 02, 2017 4:29:59 PM null
INFO: connect fresh as root
Answered By - krish Answer Checked By - Marilyn (WPSolving Volunteer)