๐๐ก๐๐ญ ๐ข๐ฌ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ? ๐๐ก๐ฒ ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ? A๐๐ฏ๐๐ง๐ญ๐๐ ๐๐ฌ ? how to connect ?
Table of contents
- ๐๐ก๐๐ญ ๐ข๐ฌ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ?
- ๐๐ก๐ฒ ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ?
- ๐๐ก๐๐ญ ๐๐ซ๐ ๐ญ๐ก๐ ๐๐๐ฏ๐๐ง๐ญ๐๐ ๐๐ฌ ๐จ๐ ๐ฎ๐ฌ๐ข๐ง๐ ๐ข๐ญ?
- ๐๐จ๐ฐ ๐๐๐ง ๐ฐ๐ ๐๐จ๐ง๐ง๐๐๐ญ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ(Slave) ๐ฐ๐ข๐ญ๐ก ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐๐ฌ๐ญ๐๐ซ?
- how to connect the slave node with the Jenkins master through SSH (Secure Shell).
- Jenkins Agent:-
- Take access to the slave node and configure it
- Again go back to the Jenkins Master dashboard
๐๐ก๐๐ญ ๐ข๐ฌ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ?
A Jenkins Agent is like a helpful ๐ฆ๐ข๐ง๐ข๐จ๐ง ๐ทโโ๏ธ for Jenkins, doing tasks remotely on other computers for you!
๐๐ก๐ฒ ๐๐จ ๐ฐ๐ ๐ง๐๐๐ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ?
๐ค To share the workload and conquer the Jenkins universe with teamwork and efficiency! ๐
๐๐ก๐๐ญ ๐๐ซ๐ ๐ญ๐ก๐ ๐๐๐ฏ๐๐ง๐ญ๐๐ ๐๐ฌ ๐จ๐ ๐ฎ๐ฌ๐ข๐ง๐ ๐ข๐ญ?
Faster, automated, saves time, and no need to do all the work yourself! ๐๐ค
๐๐จ๐ฐ ๐๐๐ง ๐ฐ๐ ๐๐จ๐ง๐ง๐๐๐ญ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ ๐๐ง๐ญ(Slave) ๐ฐ๐ข๐ญ๐ก ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐๐ฌ๐ญ๐๐ซ?
To install Jenkins please go through with previous blog here is the link
https://param036.hashnode.dev/jenkins-tutorials
In this blog, I'm going to explain
how to connect the slave node with the Jenkins master through SSH (Secure Shell).
Jenkins Agent:-
A Jenkins agent is like a trusty sidekick for your Jenkins server ๐ฆธโโ๏ธ๐ค! It's a helper bot that goes out into the world ๐ (or your computer network) to do tasks for Jenkins. Think of it as Jenkins' minion, running around and doing all the heavy lifting so Jenkins doesn't have to break a sweat! ๐ช๐
first, access your Jenkins master Dashboard.
Then click on Manage Jenkins
After clicking on manage Jenkins click on the plugin
Now click on the available plugin and search for SSH .
select the SSH and SSH server
SSH:- This plugin executes shell commands remotely using SSH protocol.
SSH server:- Adds SSH server functionality to Jenkins, exposing CLI commands through it.
Now click on Install in the top right-hand side
and wait till all plugins get downloaded successfully. After completion of download you'll able to see like this then click on Go back to top page .
It will redirect to the main Jenkins dashboard
now again click on the manage Jenkins -> Security
here we have been unable the SSH connection request
In Security make the TCP protocol to Random And Scroll down to the SSH server
In the SSH server change the SSHD port to fixed and enter port number 22
as we know SSH listens the port 22.
Now click on apply then save to save the cofigurations.
It will again redirect to the main Jenkins dashboard
Now we'll add the Slave node.
Before that
Take access to the slave node and configure it
This is the terminal of the slave node
change the root user password or else we can add a new user and you can access the new user through the Jenkins master.
here I'm going with the root user only
passwd root
Enter the password anything as per your wish and confirm it again by entering the password.
After setting the password open the sshd_config file using
vi /etc/ssh/sshd_config
In this file add the PermitRootLogin yes (anywhere you can add it)
PermitRootLogin yes
And
PasswordAuthentication yes
Before
After editing it looks like this saves the file using:wq!
Now after saving the file restart the sshd using
systemctl restart sshd
Now update the slave node
apt update -y
Now Install the Java in the slave node using
apt install default-jre
Confirmation type Y
Now Install the Jdk as well
apt install default-jdk
Confirmation type Y
now check the Java is installed or not
java -version
Again go back to the Jenkins Master dashboard
Now click on manage Jenkins -> Nodes
Now click on New node
Give the Node name and type
then click on create.
When we add a node for the first time we get only a single option โPermanent Agentโ, but after adding a slave you will get another option. This option will allow you to copy the node from another node which is named as โCopy Existing Nodeโ
Provide the remote directory where we want to build the jobs on slave_node
root directory = /root (I'm preferring this)
labels anything = paramnode (Identification Mark)
In the Launch method select Launch agents via SSH
In Host = public or private ip of the slave node
credentials = add-> Jenkins
Add credentials to move you to a new popup page.
Here select
Domain = Global credentials
kind = Username and password
username = root (whichever you're added on the slave node)
password = password of the created user on the slave node
In my case, i have set the password to the root user only
ID = Anything Not mandatory
After adding this all things
now again click on Credentials? now you're able to see the added Credentials
Before it was None
Select the root/****
Host Key Verification Strategy = Non-verifying Verification strategy
remaining to keep it as it is and click on save
Here we can see our slave_node_1 is connected with the Jenkins master
We can check the logs of it as well
click on the node name which is ***slave_node_***1 on the left-hand side then log
Thank you!!
Follow me for more content like this
please put your query in the comment box or send a mail.