how to configure Jenkins' Slave Nodes

Please follow the screen shots

Go to Configure Jenkins







[root@localhost Downloads]# scp  -i jenkinsnew.pem  slave.jar ubuntu@34.230.90.99:/home/ubuntu/
slave.jar                                                                                                          100%  713KB 713.2KB/s   00:00    
[root@localhost Downloads]# 



java -jar slave.jar -jnlpUrl http://ec2-54-210-147-105.compute-1.amazonaws.com:8080/computer/slave1/slave-agent.jnlp -secret 2120971706c29441e2b7340883b76ac6392aae123899dff360bf6c6777d0517a



root@docker:/var/lib/jenkins# java -jar slave.jar -jnlpUrl http://ec2-54-210-147-105.compute-1.amazonaws.com:8080/computer/slave1/slave-agent.jnlp -secret 2120971706c29441e2b7340883b76ac6392aae123899dff360bf6c6777d0517a
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: slave1
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener 
INFO: Jenkins agent is running in headless mode.
Jul 28, 2017 4:47:54 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: /root/.jenkins/cache/jars
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://ec2-54-210-147-105.compute-1.amazonaws.com:8080/]
Jul 28, 2017 4:47:54 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, CLI2-connect, JNLP-connect, Ping, CLI-connect, JNLP2-connect]
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: ec2-54-210-147-105.compute-1.amazonaws.com
  Agent port:    39544
  Identity:      52:d2:fa:44:9e:46:02:30:24:5d:7c:ab:16:3e:ab:0a
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to ec2-54-210-147-105.compute-1.amazonaws.com:39544
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jul 28, 2017 4:47:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: 52:d2:fa:44:9e:46:02:30:24:5d:7c:ab:16:3e:ab:0a
Jul 28, 2017 4:47:55 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected

Once it is connected you will see the Node - slave as Connected and in Green.
Congrats!!! you can run your jobs on the Slave/clients now.
I have created a sample project with just a Shell script on the slave node and I am able to Build my project on the Slave now...

I did not use any complex build, since this demo is to show only how to configure Jenkins Agents. Later you can play around with complex configuration once the connectivity is met.

I have tried to use :"Docker SSH", "SSH clients", Cloud as "Docker", AWS cloud config but nothing worked as expected. But this one is pretty simple and easy.











Enable Docker API for remote connection




1. Tried to edit DOCKER_OPTS and add this line
DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'in the /etc/init/docker.conf file. and also add this option on the existing "script" part and on the "post script" part.
Did not work - 4243 was not open when I check with # netstat - ntlp

2. Tried to edit and add DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
on the /etc/default/docker - file and restart Docker daemon.
Even this did not work.

This is only for UBUNTU
Finally this solution worked:
Edited the docker.service
root@docker:~# vi /lib/systemd/system/docker.service


# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:4243
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576

root@docker:~# systemctl daemon-reload
Warning: docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
root@docker:~# systemctl daemon-reload

root@docker:~# systemctl restart docker

root@docker:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1325/sshd
tcp6       0      0 :::8080                 :::*                    LISTEN      13926/java
tcp6       0      0 :::4243                 :::*                    LISTEN      26921/dockerd
tcp6       0      0 :::22                   :::*                    LISTEN      1325/sshd
root@docker:~# telnet localhost:4243
telnet: could not resolve localhost:4243/telnet: Name or service not known
root@docker:~# telnet localhost 4243
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^C^C^C^C
Connection closed by foreign host.
root@docker:~#

Installing Ingress Controller - Kubernetes

Installing the Ingress Controller Prerequisites Make sure you have access to the Ingress controller image: For NGINX Ingress controll...