Issue
I am just started learning Jenkins deployment on Google Kubernetes engine. I was able to successfully deploy an application to my GKE instance. However, I couldn't figure out how to manage Nodes and Clouds.
Any tutorial or guidance would be highly appreciated.
Solution
Underlying idea behind nodes : Just one node may not be sufficient/effective to run multiple jobs so to distribute the load jobs are transferred to a different node to attain a good performance.
Prerequisites
#1 : A instance (Lets’ say it DEV) which is hosting Jenkins (git, maven, Jenkins)
#2 : A instance (Let’s call it Slave) which will be used to serve as host machine for our new node
In this machine you need to have java installed A pass wordless connection should be established between two instances. To achieve it enable password authentication >generate key in main machine i.e., Dev machine and copy this key into Dev machine. Create a directory “workspace” in this machine (/home/Ubuntu/workspace)
Now Let's get started with Jenkins part - Go to manage Jenkins> Manage nodes and cloud
By default Jenkins contains only the master node
To create a new node one could use the option “new node” available on the right side of the screen.
Provide a name to new node, mark it as permanent agent
Define remote root directory : It is the directory which is defined by you.
For e.g., a location like “/home/Ubuntu/workspace “
Provide a label of your choice for e.g., let’s give the label as “Slave_lab”
Label = slave_lab
Now define your Launch method
Let’s select “Launch agent via execution of command on the master”
In the command put command as :
Ssh Ubuntu@private_IP_of_slave java -jar slave.jar Note : here by @private_IP_of_slave i mean the IP of machine which will be used for our new node
Now we could process to configure jobs to be run on our new node
For that right click on your job > select configure
Under the general tab select the following
"Restrict where this project can be run" and provide the label "slave_lab"
Now when you’ll run the job it will be executed on the slave node not on the master name.
Answered By - Abhishek Kumar