How To Add Jenkins Controller & Agent Node for Windows | Jenkins Tutorials | Part VI

How To Add Jenkins Controller & Agent Node for Windows | Jenkins Tutorials | Part VI


How To Add Jenkins Controller & Agent Node for Windows | Jenkins Tutorials | Part VI

In this video, learn how to add Jenkins controller \u0026 Jenkins agent node for Windows.
Kick Start Testing: https://accounts.lambdatest.com/regis
Learn more: https://www.lambdatest.com/continuous

This is Part VI of the Jenkins LambdaTest Tutorial series wherein Moss (@tech_with_moss), a DevOps engineer, explains about configuring Jenkins controller and Jenkins agent nodes to overcome the limitation of a single Jenkins instance. The growing organization needs to scale Jenkins on multiple platforms like Windows, Mac OS, Ubuntu, and Linux.

- Jenkins agents are machines to whom Jenkins controllers can delegate the task of building projects distributed across different platforms that support Java. It allows multi-platform build and testing using the same Jenkins Server.
- An agent node might be a windows machine, a Linux machine, or some other platform that supports Java; this allows multi-platform build and testing using the same Jenkins server.

You will also learn
🔸 How does Jenkins connect to Windows agent?
🔸 Where does Jenkins agent run?
🔸 How does Jenkins agents work?
🔸 How do you deploy Jenkins agent and connect it to Jenkins master?

Vɪᴅᴇᴏ Cʜᴀᴘᴛᴇʀꜱ
0:00 Introduction to Jenkins Tutorial for Beginners
0:40 Problems with single Jenkins Server and Need for Jenkins Controller-Agent setup
1:10 Jenkins Controller/Agent (Master/Slave) Architecture
2:03 How to add a Jenkins Controller Node
5:25 How to add a Jenkins Windows Agent Node for Local system setup
7:38 Configuring the global security to activate the local Windows Jenkins Agent Node
10:00 Testing the Jenkins Controller/Agent setup for Windows
11:48 Conclusion

𝑪𝒐𝒎𝒑𝒍𝒆𝒕𝒆 𝑷𝒍𝒂𝒚𝒍𝒊𝒔𝒕
◾ What is Jenkins, and Why is it used? | Jenkins Tutorial | Part I: https://bit.ly/3fzh1il
◾ How to Install and Configure Jenkins? | Jenkins Tutorial | Part II: https://bit.ly/2VZhNhl
◾ How To Install Maven Plugin | Jenkins Tutorial | Part III: https://bit.ly/38CcOqh
◾ Jenkins GitHub Integration | Jenkins Tutorial | Part IV: https://bit.ly/3skqHSJ
◾ Creating Jenkins Job For Maven Project | Jenkins Tutorial | Part V: https://bit.ly/3g6mflN
◾ How To Add Jenkins Controller \u0026 Agent Node for Windows | Jenkins Tutorial | Part VI: https://bit.ly/3yPowZZ
◾ Add a Jenkins controller and Jenkins agent node in azure | Part VII: https://bit.ly/37IOx14
◾ Jenkins Pipeline Tutorial | Jenkins Tutorial | Part VIII: https://bit.ly/3iUVP8B
◾ Cross Browser Testing With LambdaTest Jenkins Plugin | Part IX: https://bit.ly/3jUH4ln

The above Jenkins tutorial for beginners for testing covers the Jenkins introduction, Jenkins basics, what is Jenkins and how it works, installation, configuration on a local machine, Jenkins and GitHub integration, scheduling Jenkins, creating Jenkins job for a maven project, Jenkins controller and Jenkins agent nodes for the distributed build, Jenkins pipelines, automated cross-browser testing, Jenkins pipeline, and much more insights on Jenkins for beginners.

𝑹𝒆𝒍𝒂𝒕𝒆𝒅 𝑩𝒍𝒐𝒈𝒔
◾ What is Jenkins used for?: https://bit.ly/3tJ2Bkz
◾ How To Set Jenkins Pipeline Environment Variables?: https://bit.ly/2VFRM6K
◾ Comprehensive Guide To Jenkins Declarative Pipeline: https://bit.ly/3jJDBpI

What else?
+ Test website on 2000+ mobile and desktop browser environments over LambdaTest cloud
+ 100 minutes of free automated testing
+ Sessions with 10 Minutes of Each Free Live Interactive testing per month
+ 10 Responsive Testing across 56 Device configurations with a single click
+ 30 minutes of free testing on LT Browser

😃 For query: [email protected]

𝑬𝒙𝒑𝒍𝒐𝒓𝒆
🎬 MOST RECENT VIDEOS: https://bit.ly/3kUUeAQ
🎓 LEARN MORE AT LAMBDATEST: https://bit.ly/3fr6l4Z
🎥 BUSINESS PROBLEM SOLUTIONS/CASE STUDIES: https://bit.ly/2TB7pvD
🚀 WEBINARS: https://bit.ly/37i41co
🛠️ PRODUCT UPDATES: https://bit.ly/3717NGO
💬 LAMBDATEST GLOBALLY RECOGNIZED CERTIFICATIONS: https://bit.ly/3x4EtcY
📢 FREE For Limited Time Only 🕑, Enroll Now! 👈

𝑺𝒐𝒄𝒊𝒂𝒍
📝 BLOG: https://bit.ly/3yGVsUc
👥 COMMUNITY: https://bit.ly/3Aiz5oO
🔴 NEWSLETTER: https://bit.ly/3juhxzc
🖼️ GITHUB: https://bit.ly/3jowfYs
🛠️ YOUTUBE : https://bit.ly/3rH2Yfh
🌎 LINKEDIN: https://bit.ly/3xA6F84
👥 FACEBOOK: https://bit.ly/37mbQOa
🐦 TWITTER: https://bit.ly/3Cn0g3A
📸 PINTEREST: https://bit.ly/2VCXI05

#jenkinstutorial #jenkinscontroller #jenkinsagent #testing #jenkins #automation #javascript #developers

Disclaimer:
This video features materials protected by the Fair Use guidelines of Section 107 of the Copyright Act. All rights reserved to © 2021 LambdaTest. Any illegal reproduction of this content will result in immediate legal action


Content

5.2 -> hey what's up everybody and welcome back to our  tutorial series on jenkins in the last video i  
10.48 -> showed you how to create a jenkins job for a  simple maven project and our jenkins server  
15.12 -> has no problem running this job or really any of  the jobs that we've created in the previous videos  
20.32 -> but in a corporate environment jenkins jobs might  consume a significant percentage of resources on  
26.08 -> the machine that's hosting the jenkins server  especially when there are many jobs ran in  
30.64 -> parallel so let's take a look at our next topic  that will help mitigate this challenge in this  
35.76 -> video we are going to configure jenkins controller  and jenkins agent nodes and before i walk you  
42.08 -> through the configuration steps i first want to  discuss the problem that we're trying to solve  
47.52 -> as software teams and their organizations  grow so does the need to scale jenkins  
52.8 -> in addition software teams may need to build and  test software on multiple platforms like windows  
58.88 -> mac os and linux and a single jenkins instance  will likely be unable to meet these requirements  
65.12 -> in order to meet these requirements we  must scale jenkins up and or out jenkins  
71.04 -> can support organizational growth as well as the  need for multi-platform build and testing through  
75.84 -> the use of agents jenkins agents are machines  that the jenkins controller can delegate the  
80.8 -> task of building projects to in a distributed  manner an agent node might be a windows machine  
86.48 -> a linux machine or some other platform that  supports java this allows multi-platform build  
92.16 -> and testing using the same jenkins server and it  also allows us to scale our jenkins out as needed  
98.32 -> all we need to do is add additional agent nodes  if we take a look at the architecture shown here  
103.6 -> the jenkins controller node is the jenkins server  that we've already configured in previous videos  
109.04 -> we will be adding a windows agent node  in this video after we've configured our  
113.36 -> jenkins agents the jenkins controller will  be able to schedule builds on jenkins agents  
118.08 -> according to the jenkins job configuration  now that we've covered those details  
122.4 -> let's get started so the first step to set up  our jenkins controller in jenkins agent nodes  
128.4 -> is to create an ssh key pair i have my terminal  up already i'm using git bash and in git bash i'm  
135.76 -> going to use the ssh keygen command to generate a  new key pair and i'll call it azure jenkins agent
149.44 -> and i'll leave the passphrase empty  
152.64 -> okay so that generated a new key pair  and i'm going to cap the private key
163.28 -> and i'm going to copy the  contents of the private key
172.24 -> and then i'm going to navigate to jenkins and in  the jenkins controller i'm going to navigate to  
179.44 -> manage jenkins and then we'll  navigate to manage credentials
187.68 -> we'll open up the jenkins credential store  and then global credentials and then i'm  
193.2 -> going to select add credentials and then the  kind of credential that we're going to use  
198.48 -> is ssh username with private key and we'll give  it an id we'll say it's azure jenkins agent and  
210.32 -> the username is going to be azure user and  then the private key will enter directly  
218.64 -> and i'll just paste the private key into  that field okay and then i'll select okay  
227.28 -> the next step is to copy our public key to the  machine that is going to be our jenkins agent  
232.96 -> hosted in azure and i already have an ssh session  open with that machine so i'm going to open up  
240.88 -> that session and i'm currently on the logged  onto the machine or the vm that will be running  
250.8 -> as a jenkins agent and i'm going to modify  the authorized the authorized keys file
262.88 -> and add the public key that we just created okay
274 -> so in the other terminal window  i'm going to cat the public key
288.56 -> and i'll copy the public key value and i'll  add this public key to the authorized keys list
303.84 -> and then we will save that file so now we should  be able to ssh or this jenkins instance should  
311.92 -> be able to ssh to this vm hosted in azure so we  can begin configuring this azure vm as a jenkins  
322.08 -> instance inside of our jenkins controller so i'm  going to navigate back to the jenkins dashboard  
330.56 -> and from here i'm going to  navigate to manage jenkins  
335.2 -> and then i'm going to select manage nodes and  clouds so we're going to create one additional  
340.88 -> node and i'm going to use this windows pc as  the second node so i'm going to select new node  
350.64 -> and we'll call it windows agent i'll select a  permanent agent even though i do have the option  
358.08 -> to copy from an existing node and i'll select  ok i'll leave the number of executors at one and  
366.32 -> then i'll use the same remote root directory  i'll just call call it jenkins agent data
376 -> and for labels i'll use the windows label usage  i'll leave usage as default and then the launch  
387.12 -> method will use launch agent by connecting  it to the master and one reason besides just  
395.12 -> to demonstrate this launch method uh one other  reason to use this launch method is because  
402 -> i'm on this windows pc is on my home  network and the azure vm is has a public ip  
409.92 -> and it's accessible so i can use the uh the ssh  connect to via ssh in that case because port 22  
420.32 -> is open and the ip for that azure vm is public but  for this windows pc the ip address is not public  
429.36 -> and by using this launch method i can  start the agent program locally and then  
436.16 -> specify the ip address of the controller and  establish a connection an outbound connection  
442.32 -> to the controller that way since the  controller does have a public ip address  
446.8 -> i'll leave the rest of the configurations for this  launch method as default same for the availability  
455.36 -> and then i'll select save so now you can see that  the windows agent has been added but there is an x  
462.96 -> over the node indicating that jenkins is  not connected with it and if we click on  
468.56 -> the agent it says that the jnlp agent port is  disabled and agents cannot connect this way  
475.68 -> and it even tells us where we need to go  to update the configuration so that this  
482.48 -> so that this works correctly so  i'm going to follow this hyperlink  
487.44 -> and this takes me to the global security page  of jenkins and if i scroll down to the agents  
496.56 -> section i have to enable a tcp port for  inbound agents and i can select random or fixed  
507.04 -> and i'm going to select fixed and i'm going to  enter just you know a high value port number  
515.76 -> that i know is not being used  and then i'm going to select save
522.96 -> now i'll select manage nodes in clouds  and i'll select the windows agent again  
528.4 -> and now you can see that it tells us  at the top we can connect to the agent  
534.64 -> uh using one of these ways and the first we can  run uh from the aging command line this command  
543.2 -> and this is the command that we're going to use  to run the agent program on this windows pc so  
548.96 -> i'm going to copy this command to my clipboard and  i'm going to download the agent.jar file locally
559.68 -> and now that we have that downloaded  i'm going to open up a git bash session  
566.72 -> and i'll navigate to the directory  where the agent.jar file was downloaded
573.6 -> and i'm going to paste the command  
578 -> into the session and we'll run it and  see if if the agent connects successfully
588.88 -> okay and it looks like it did connect  it says that it's connected right there
595.2 -> so i'll refresh the page and it says that the  
598.48 -> agent is connected i'll navigate back  to the dashboard we'll create a new item  
606.4 -> and we'll call it test windows agent  i'll select freestyle project and then  
614.32 -> i'll select restrict where this project can be  ran and i'll use the windows label this time
627.12 -> and in the build section i'm going to add a single  
631.04 -> build step execute shell and we'll  say echo hello world to helloworld.txt
642.64 -> and we'll select save and then  let's go ahead and build this job
654.88 -> okay so i'll navigate into the the job console  output and you can see at the top of the console  
662.8 -> output it's building remotely on the windows agent  using the windows label and then it specifies  
669.36 -> the workspace that it's using on my local windows  pc and it looks like it was successful with the  
676.72 -> echo command as well we can quickly verify that in  git bash supply cd to downloads and then jenkins  
685.84 -> agent data i'll cd into the workspace and then  i have the job directory if i cd into the job  
695.52 -> directory we can see the hello world dot txt file  did get created if i cat that the hello world is  
706.56 -> in that text file if you'd like to learn more  be sure to follow our blog at lambdatest.com  
712.8 -> forward slash blog as well as our lambda  test community at community.lambdatest.com  
718.48 -> you can also earn resume worthy lambda test  selenium certifications at lambdatest.com  
723.52 -> forward slash certifications so  i will see you in the next video
735.76 -> you

Source: https://www.youtube.com/watch?v=V2ejGOY_uJI