Day-19 | Jenkins ZERO to HERO | 3 Projects Live |Docker Agent |Interview Questions | #k8s #gitops
Zusammenfassung
TLDRDans cette vidéo, Abhishek guide les spectateurs à travers l'installation de Jenkins, un outil d'intégration et de livraison continues, sur une instance EC2 d'AWS. Il démontre comment configurer Jenkins pour s'exposer à l'extérieur, utiliser Docker comme agent pour exécuter les pipelines Jenkins, et déployer des applications sur un cluster Kubernetes. L'utilisation de Docker comme agent permet de profiter de la légèreté des conteneurs qui facilitent le test et le déploiement des applications sans les conflits de dépendances typiques des machines virtuelles traditionnelles. En utilisant Docker, chaque étape du développement utilise des conteneurs dédiés, assurant une isolation propre et réduisant les coûts de maintenance. Abhishek fournit également des astuces pour écrire des pipelines Jenkins et discute des bonnes pratiques pour gérer et optimiser les instances Jenkins et ses agents dans un environnement professionnel.
Mitbringsel
- 👨💻 Jenkins permet d'automatiser les processus DevOps.
- 🐋 Utiliser Docker comme agent maximise l'efficacité.
- ☁️ Déployer Jenkins sur une instance AWS EC2.
- 🔗 Argo CD simplifie le déploiement sur Kubernetes.
- 🛠️ Docker garantit une isolation des processus.
- 📜 Un pipeline Jenkins gère plusieurs étapes de développement.
- 🔄 Redémarrer Jenkins après l'installation de plugins.
- 🔍 Jenkins utilise des repo SCM pour le code source.
- 🗂️ Les conteneurs facilitent la gestion des dépendances.
- 🛡️ Assurer que Jenkins est exposé correctement pour l'accès externe.
Zeitleiste
- 00:00:00 - 00:05:00
Abhishek inaugure le 19ème jour de son cours complet sur le Devops et se concentre sur l'implémentation pratique de Jenkins, en commençant par son installation, l'exposition aux accès externes, la configuration de Docker comme agent, et enfin le déploiement d'applications sur un cluster Kubernetes. Il propose des ressources sur un dépôt GitHub pour suivre ses instructions.
- 00:05:00 - 00:10:00
Abhishek crée une instance EC2 sur AWS, installe Java et Jenkins tout en s'assurant que les paquets nécessaires sont mis à jour. Il souligne l'importance de configurer les règles de sécurité AWS pour que Jenkins soit accessible via le port 8080.
- 00:10:00 - 00:15:00
Il explique comment accéder à Jenkins une fois installé et comment installer les plugins recommandés. Il insiste sur la nécessité de passer au pipeline Jenkins pour une meilleure gestion des versions et de préférer les pipelines à la configuration manuelle des projets freestyle.
- 00:15:00 - 00:20:00
Abhishek explique la transition vers l'usage de Docker comme agent Jenkins pour éviter les problèmes de dépendance liés à l'utilisation de machines virtuelles multiples et démontre que ce nouveau modèle permet de créer et détruire des conteneurs selon les besoins, réduisant ainsi les coûts et la maintenance.
- 00:20:00 - 00:25:00
Il montre comment installer Docker sur l'instance Jenkins, accorder les droits nécessaires au démon Docker pour Jenkins et Ubuntu, et l'importance de redémarrer Jenkins pour que les changements soient pris en compte.
- 00:25:00 - 00:30:00
L'utilisation du plugin Docker Pipeline dans Jenkins est mise en avant pour faciliter l'exécution des pipelines sur les agents Docker. Abhishek passe en revue les différentes manières de créer un pipeline dans Jenkins, en insistant sur la flexibilité et la réutilisabilité des pipelines codés par rapport aux projets freestyle.
- 00:30:00 - 00:35:00
Abhishek construit un pipeline Jenkins simple afin de tester la configuration de Docker comme agent et souligne la simplicité et l'efficacité du modèle. Il montre qu'une fois le travail terminé, les conteneurs sont supprimés, prouvant la fluidité de l'intégration de Docker dans Jenkins.
- 00:35:00 - 00:40:00
Il passe ensuite à des pipelines plus complexes, montrant comment gérer des applications à trois niveaux avec des configurations de dockerisation distinctes pour le front-end, le back-end et la base de données, et comment exécuter ces applications sur différents conteneurs Docker spécialisés.
- 00:40:00 - 00:45:00
Abhishek introduit un projet plus complexe de CI/CD qui implique Jenkins et Argo CD pour le déploiement continu sur Kubernetes. Il explique comment Jenkins peut être configuré pour surveiller les changements de code et déployer automatiquement ces mises à jour via Argo CD sur un cluster Kubernetes.
- 00:45:00 - 00:50:00
Il résume les étapes nécessaires pour installer Argo CD et configurer une application Python simple, en montrant comment utiliser Jenkins pour compiler, tester et mettre à jour les déploiements Kubernetes de manière fluide. Abhishek offre aussi des références pour une compréhension plus approfondie grâce à des vidéos complémentaires.
- 00:50:00 - 00:59:25
Enfin, Abhishek termine par des questions courantes en entretien sur Jenkins et la CI/CD, offrant des stratégies pour expliquer les processus CI/CD en entreprise et aborder les défis techniques, et renvoie à d'autres ressources pour approfondir le sujet pour les interviews.
Mind Map
Video-Fragen und Antworten
Que couvre cette vidéo sur Jenkins ?
Cette vidéo couvre l'installation de Jenkins, son exposition, la configuration de Docker comme agent et le déploiement d'applications sur Kubernetes.
Pourquoi utiliser Docker comme agent pour Jenkins ?
Docker est utilisé comme agent pour profiter des conteneurs légers, évitant ainsi les conflits de dépendance et facilitant l'évolutivité.
Comment Jenkins interagit-il avec Docker ?
Jenkins utilise des conteneurs Docker pour exécuter les pipelines, en créant et supprimant les conteneurs selon les besoins.
Quelles sont les étapes principales d’un pipeline Jenkins ?
Les étapes incluent généralement le checkout de code, la construction, les tests et le déploiement.
Quelle est la différence entre un projet freestyle et un pipeline dans Jenkins ?
Un projet freestyle utilise des interfaces graphiques pour la configuration, tandis qu'un pipeline est une approche de code, permettant une gestion versionnée.
Comment Jenkins gère-t-il les projets multi-agent ?
Jenkins utilise des configurations de conteneurs Docker multiples pour gérer les différentes étapes d'un projet multi-agent.
Pourquoi Argo CD est-il recommandé pour le déploiement continue avec Kubernetes ?
Argo CD propose un déploiement continue déclaratif, surveillant les changements et s'assurant que l'état du cluster correspond toujours au référentiel Git.
Quelle est l’importance du redémarrage de Jenkins après l’installation de plugins ?
Redémarrer Jenkins après l'installation de plugins assure que les changements sont bien pris en compte.
Qu'est-ce qu'un CI/CD ?
CI/CD signifie Intégration Continue/Déploiement Continu, des pratiques clés dans le développement logiciel.
Comment Jenkins s'intègre-t-il avec des outils de contrôle de version ?
Jenkins s'intègre via des plugins pour automatiser le processus de construction et de déploiement à partir de dépôts de code source.
Weitere Video-Zusammenfassungen anzeigen
Korrektes Abkuppeln eines LKW Anhängers - Klasse CE
Webinaire : La conjoncture du crédit immobilier pour les non-résidents et les expatriés à la mi 2023
VOUS NE DONNEREZ PAS VOS PERRUQUES À N'IMPORTE QUI APRÈS AVOIR REGARDÉ ÇA ! #
VP Sara Duterte press conference | December 11, 2024
Jó || Bible Project Português ||
LA GRANDE PESTE NOIRE DU MOYEN ÂGE
- 00:00:02hello everyone my name is Abhishek and
- 00:00:04welcome back to my channel so today we
- 00:00:06are at day 19 of our complete devops
- 00:00:08course and in this video we will see
- 00:00:10practical implementation of Jenkins so
- 00:00:13that's the reason why I call it Jenkins
- 00:00:150 to 0 right so if you look at the about
- 00:00:17section I explained what are we going to
- 00:00:19do today uh that is uh install Jenkins
- 00:00:22and then we will see how to expose this
- 00:00:24Jenkins to outside world after that
- 00:00:27we'll see how to configure Docker as
- 00:00:28agent will not create multiple ec2
- 00:00:31instances and configure them as worker
- 00:00:33nodes to this Jenkins Master but we will
- 00:00:36see how to use Docker so that you know
- 00:00:38containers as you know they are very
- 00:00:40lightweight and they have lot of
- 00:00:42advantages so I'll try to explain why
- 00:00:44you should also follow this approach so
- 00:00:46stay with me it might be uh a little bit
- 00:00:49lengthy video but try to follow the
- 00:00:52video till end so that you will get a
- 00:00:54good benefit out of the video
- 00:00:55and finally we'll also see how to deploy
- 00:00:58this applications onto a kubernetes
- 00:01:00cluster so if you feel somewhere that
- 00:01:02you are not able to follow the video or
- 00:01:04I'm going little speed don't worry I've
- 00:01:06documented the entire things in the
- 00:01:07readme section of this GitHub repository
- 00:01:09uh right from installation to everything
- 00:01:12that we are going to today so
- 00:01:14you can Fork this repository or you can
- 00:01:16start this repository so that you can
- 00:01:18follow the video accordingly at your
- 00:01:20suitable time
- 00:01:22perfect now
- 00:01:24firstly what we will do is we'll start
- 00:01:26with an ec2 instance if you see here
- 00:01:29this is my AWS console and I have
- 00:01:32already launched a ec2 instance so there
- 00:01:35is no special requirement but if you
- 00:01:36want to follow the document as is so I
- 00:01:39have some commands that I've provided
- 00:01:40for you how to install Java Jenkins and
- 00:01:43all so if you want to follow the video
- 00:01:44as is you can create an Ubuntu instance
- 00:01:47so so that all the APT commands will be
- 00:01:49applicable to your instance as well
- 00:01:52so I just created a Jenkins instance and
- 00:01:55what we will do is we'll try to start
- 00:01:57with installing Jenkins on it right the
- 00:02:00name is Jenkins but it's just an easy to
- 00:02:02instance uh without any uh software
- 00:02:04packages installed in it right so let me
- 00:02:07take the terminal and firstly what we
- 00:02:09need to do we need to copy the instance
- 00:02:12public IP address so I'll copy the
- 00:02:14instance public IP address and if you
- 00:02:16see here I have my console let me
- 00:02:18increase the font
- 00:02:21right so first of all we'll try to SSH
- 00:02:25to that ec2 instance
- 00:02:29uh let me change the public IP address
- 00:02:31so I am using my key value pair and
- 00:02:35I have SSH to that ec2 instance right so
- 00:02:39I am currently logged into the ec2
- 00:02:41instance now the first thing that you
- 00:02:43need to do is Jenkins is a Java based
- 00:02:46application okay so for that to be
- 00:02:48installed you need to have Java as a
- 00:02:50prerequisite so that is also provided in
- 00:02:52the document if you see the prerequisite
- 00:02:54Java or jdk is a prerequisite so firstly
- 00:02:57you need to run this set of commands
- 00:02:59Okay firstly we are updating the APT
- 00:03:02packages and then we are installing the
- 00:03:05jdk so versions okay so if you want to
- 00:03:09go with the document just use the
- 00:03:11commands as is or if you have a
- 00:03:12requirement of any specific version then
- 00:03:14you can change them as well
- 00:03:17but I would recommend you to follow the
- 00:03:19versions as is because I try to keep it
- 00:03:21as latest as possible
- 00:03:25so this is this will just take a second
- 00:03:27and after your uh app to get update is
- 00:03:31done and you have installed the jdk you
- 00:03:33can verify if your Java is installed or
- 00:03:35not using this specific command once
- 00:03:37that is done you can follow or you can
- 00:03:39copy the exact same command to install
- 00:03:41Jenkins as well
- 00:03:42so I'll just copy the commands to
- 00:03:45install Jenkins let's say you are on
- 00:03:47Centos or you are on a different uh uh
- 00:03:50distributions of Linux don't worry you
- 00:03:52can get the commands from official
- 00:03:54Jenkins documentation so all that you
- 00:03:56need to do is just search for Jenkins
- 00:03:58here and go to the official
- 00:04:01documentation once you go there uh click
- 00:04:03on the documentation option and then you
- 00:04:05have installing Jenkins and to your
- 00:04:07right side you have apps options like uh
- 00:04:09Linux kubernetes where do you want to
- 00:04:11install so click on Linux and then
- 00:04:13choose your distribution let's say
- 00:04:15you're on Centos so you have commands to
- 00:04:17install
- 00:04:18Jenkins on centralized but the only
- 00:04:20prerequisite is you need to have Java
- 00:04:23installed on it
- 00:04:24okay so we are installing Jenkins uh
- 00:04:28Java installation is done after that you
- 00:04:30will have your Jenkins service started
- 00:04:32okay
- 00:04:35right so one thing uh is even when we
- 00:04:38are talking about the uh AWS ec2
- 00:04:41instances you need to understand that by
- 00:04:43default your ec2 instances will not
- 00:04:46accept traffic from external world that
- 00:04:48is the inbound traffic rules are blocked
- 00:04:51by default so if you want to access any
- 00:04:53application like Jenkins is an
- 00:04:55application which has its application
- 00:04:57running on port 8080 if you want to see
- 00:05:00that what is the command you can just
- 00:05:01say PS hyphen EF and grab for the
- 00:05:04process called Jenkins right if you do
- 00:05:07that you can see clearly that okay so
- 00:05:09Jenkins is running on this specific
- 00:05:11instance and the port is 8080 right so
- 00:05:14port 8080 is not accessible to external
- 00:05:18World AWS is blocking that on this on
- 00:05:21this specific IP address so what you
- 00:05:23need to do is go to the security okay if
- 00:05:25you see here this is security and click
- 00:05:28on the existing Security Group so these
- 00:05:30are the default security groups that are
- 00:05:32as attached to your ec2 instance what
- 00:05:34you'll do is edit the inbound rules
- 00:05:36inbound rules is nothing but the traffic
- 00:05:38that is coming inside or to your ec2
- 00:05:41instance click on add a rule what you
- 00:05:43can do is you can select custom TCP and
- 00:05:46select a port range but in my case I
- 00:05:48directly know the port that is 8080 and
- 00:05:51this is very important this is the
- 00:05:54source IP address let's say you only
- 00:05:56want this ec2 instance to be accessed
- 00:05:58from the laptop you can use my IP let me
- 00:06:00put it as anywhere and you can also
- 00:06:02instead of custom TCP you can allow all
- 00:06:05the traffic right now I'm I'll delete
- 00:06:07the instance after the usage so I can
- 00:06:09allow all traffic and even I love
- 00:06:12everybody The Source IP is 0 0 so that
- 00:06:14anybody can access this Jenkins instance
- 00:06:16okay so most of the people might already
- 00:06:19know this process so if you feel that
- 00:06:21you already know how to use this till
- 00:06:23this point of time okay uh pretty cool
- 00:06:26uh the topics that we are going to cover
- 00:06:28after this might uh like it might be
- 00:06:31something that you might not be aware
- 00:06:33like using Dot occur as an agent or
- 00:06:35deploying the applications onto
- 00:06:37kubernetes so stay with me and uh try to
- 00:06:40be focused on the entire video
- 00:06:43perfect
- 00:06:45so right now I allowed the easy to
- 00:06:49specific Port range to be accessed from
- 00:06:52external world if I go to the ec2
- 00:06:54instance select the public IP address I
- 00:06:57just copied it now let me see if Jenkins
- 00:06:59instance is accessible or not okay so I
- 00:07:03copied the IP address and the port is
- 00:07:058080 so let me even select that port and
- 00:07:08click on enter once you do that yeah
- 00:07:11right now you have Jenkins installed and
- 00:07:13Jenkins is running on this ec2 instance
- 00:07:16so what Jenkins is saying the initial
- 00:07:18password can be copied from this
- 00:07:20specific file so I'll just catch that
- 00:07:23specific file and get the initial
- 00:07:24password okay you need to use sudo
- 00:07:27because this is a root file location
- 00:07:31uh what is happening okay so let me do
- 00:07:34this uh sudo cat followed by the
- 00:07:37location of the file and this is my
- 00:07:39initial password I copied the initial
- 00:07:41password and pasted it here now I am
- 00:07:43able to sign into Jenkins okay once you
- 00:07:46do this uh you have two options one is
- 00:07:49install suggested plugins and select
- 00:07:51plugins to install go with the suggested
- 00:07:53plugins because uh Jenkins has already
- 00:07:55uh categorized the most useful plugins
- 00:07:58uh it depends upon the analytics uh
- 00:08:00which plugins are most used so Jenkins
- 00:08:02has come up with a list and Jenkins said
- 00:08:04that okay so these are the list of
- 00:08:05plugins that many people are using and
- 00:08:07even you it might be useful for you
- 00:08:09and at any given point of time you can
- 00:08:12go to Jenkins and install any plugins
- 00:08:14that you want
- 00:08:15while this is getting installed let me
- 00:08:18tell you one more time all of these
- 00:08:20things are available in the document
- 00:08:21like if you see here this is how you
- 00:08:23copy the password and then you click on
- 00:08:25in uh sorry install suggested plugins
- 00:08:27then what you need to do after that so
- 00:08:30everything is present as part of the
- 00:08:32GitHub repository so you can clone or
- 00:08:34Fork this Repository
- 00:08:36perfect let me go back and see what is
- 00:08:38the status so the plugins are still
- 00:08:40getting installed uh if you feel that I
- 00:08:43don't want all of this plugins it's
- 00:08:44wasting a lot of time for me you can
- 00:08:46just go with install selected plugins as
- 00:08:48well if you are going to use this
- 00:08:49instance for a long time I would highly
- 00:08:52recommend you to configure the username
- 00:08:54and password you can choose a easy one
- 00:08:56as well and
- 00:08:58the reason for that is uh you know this
- 00:09:01is your administrative password the one
- 00:09:03that comes by default uh is like you
- 00:09:05know it's like a test password or it's a
- 00:09:07password that uh you can only use it
- 00:09:12I mean it's a password that Jenkins
- 00:09:14would recommend to change it in the
- 00:09:15future uh so I'm sticking to my IP
- 00:09:17address and port and click on Save and
- 00:09:20finish
- 00:09:21right so start using Jenkins that means
- 00:09:23you are Jenkins installation part is
- 00:09:26done so right now what we have done is
- 00:09:28we have installed Jenkins now let me
- 00:09:31take a moment and explain you how
- 00:09:33Jenkins Works in real time I'm not going
- 00:09:35to talk about the pipeline uh so because
- 00:09:37we already discussed about the pipeline
- 00:09:39what is the orchestration in Jenkins
- 00:09:41what are the different stages uh that
- 00:09:43you could uh integrate in Jenkins in the
- 00:09:45previous class so I'm not going to talk
- 00:09:47it but how Jenkins architecture works
- 00:09:50that is if you see here usually to the
- 00:09:53left side okay so to the left side of
- 00:09:55the diagram I have a Jenkins Master
- 00:09:56where the Jenkins is right now installed
- 00:09:59so this ec2 instance that we are using
- 00:10:02can be considered as Jenkins master and
- 00:10:04what usually happens is in an
- 00:10:06organization let's say we are working
- 00:10:07for amazon.com so in amazon.com people
- 00:10:11create ec2 instance on Jenkins master
- 00:10:13and because there are multiple
- 00:10:15developers multiple project teams and
- 00:10:17multiple development teams so Jenkins
- 00:10:20gets a lot of load to offload these
- 00:10:23things so what Jenkins does is you
- 00:10:25should always use Jenkins Master only
- 00:10:27for the scheduling purpose okay because
- 00:10:29all of the things cannot be run on a
- 00:10:32single Jenkins Master right if
- 00:10:33everything runs on a single Jenkins
- 00:10:35Master then it will have conflicting
- 00:10:37packages let's say one team requires a
- 00:10:40Java version 7 and the other team
- 00:10:41requires Java version right uh sorry
- 00:10:43eight someone requires python to someone
- 00:10:46requires Python 3 so it is technically
- 00:10:48not possible to have everything to run
- 00:10:50in one Jenkins Master not good for the
- 00:10:52purpose of load and not good even for
- 00:10:54the purpose of
- 00:10:56like you know dependency conflicts so
- 00:10:59what people do is they create a Jenkins
- 00:11:01master and they create Jenkins worker
- 00:11:03nodes like let's say this worker node
- 00:11:05should be used by applications one to
- 00:11:07ten this worker node should be used by
- 00:11:10applications 10 to 20 or this worker
- 00:11:12node should be only used by a specific
- 00:11:13development team or this should be only
- 00:11:16for Windows applications this should be
- 00:11:18only for Linux applications so people
- 00:11:20categorize that who is responsible for
- 00:11:22these things devops engineers are
- 00:11:24responsible for these things but
- 00:11:26saying that this architecture was well
- 00:11:29and good like two years ago or three
- 00:11:31years ago but with the advancement of
- 00:11:33micro services with the advancement of
- 00:11:35the kubernetes micro service
- 00:11:37architecture the problem is that you
- 00:11:40have
- 00:11:40different types of applications like you
- 00:11:42know the scale of your micro Services
- 00:11:44has gone leaps and bonds so with this
- 00:11:47approach you might uh end up like let's
- 00:11:49say this project team okay or the
- 00:11:52windows applications uh Jenkins worker
- 00:11:54node it is not at all getting uh any
- 00:11:56requests or there is no change to the
- 00:11:58applications that are made so always
- 00:12:00this ec2 instance is sitting idle let's
- 00:12:03say this is one ec2 instance and you
- 00:12:05have 20 ec2 instances as worker nodes
- 00:12:07okay so whenever Jenkins Master gets a
- 00:12:10request for uh Windows what usually does
- 00:12:13is because it says that okay Windows
- 00:12:16should always go to Jenkins worker Note
- 00:12:173 for execution of pipelines it will
- 00:12:19only send windows but
- 00:12:22what we have noticed is that the
- 00:12:24requirement for the windows is coming
- 00:12:25very rare okay only very I mean very
- 00:12:28rarely these applications related to
- 00:12:30windows are being changed so the Jenkins
- 00:12:32worker Note 3 is always sitting idle
- 00:12:35that means you are wasting the resources
- 00:12:37on your AWS instance now you can say
- 00:12:40that okay I can always go back and turn
- 00:12:42down this ec2 instance or you know stop
- 00:12:44this ec2 instance only when it is
- 00:12:46required but you never know when is it
- 00:12:47required right or you can configure an
- 00:12:49auto scaling group okay but even if
- 00:12:52you're configuring Auto scaling group
- 00:12:53then again you know you at least need to
- 00:12:55have one worker node and
- 00:12:57you know you don't know which
- 00:12:58requirement is coming to you whether
- 00:13:00it's a Windows application whether it's
- 00:13:01a Linux application node.js application
- 00:13:03you don't know so you have all of these
- 00:13:06challenges with configuring worker nodes
- 00:13:09which are easy to instances
- 00:13:11so to solve this problem in today's
- 00:13:13class what we are going to see is we are
- 00:13:15going to see the latest approach that is
- 00:13:17using Jenkins with Docker as agents that
- 00:13:20means the Jenkins pipelines or the
- 00:13:23Jenkins stages what we will do is we
- 00:13:24will try to run this Jenkins Pipeline on
- 00:13:27Docker containers so everybody knows
- 00:13:29what is the advantage of Docker
- 00:13:30containers right so if you are using
- 00:13:32Docker containers they are very light in
- 00:13:34weight against virtual machines so if
- 00:13:36you are using a Docker container let's
- 00:13:38say tomorrow somebody comes here and
- 00:13:40says that oh okay I'm using node.js15
- 00:13:43upgrade to node.js16 then you have to
- 00:13:45log into the worker node change the
- 00:13:47node.js to 16. then again uh there can
- 00:13:50be conflicting packages like you know
- 00:13:51one team in worker node might say that I
- 00:13:54want to use node.js 15 and the other
- 00:13:56team using worker node one they might
- 00:13:58want to say that okay I want to use
- 00:13:59node.js 16. so this problem can be
- 00:14:01solved by containers because containers
- 00:14:03can be anytime created destroyed they
- 00:14:06can be upgraded you just have to modify
- 00:14:08the docker file and then you can use any
- 00:14:10container that you would want right so
- 00:14:12and most of the default containers like
- 00:14:15you know if you want a node.js container
- 00:14:17you don't even have to write a Docker
- 00:14:19file you can directly use that from
- 00:14:20Docker Harbor somewhere so that's why
- 00:14:23the containers usage for Docker I mean
- 00:14:26only if your applications are light in
- 00:14:28weight like let's say your application
- 00:14:30is a database application then in some
- 00:14:32cases this container approach might not
- 00:14:34work but to have a good resume or to
- 00:14:37have a good project in your resume
- 00:14:38always try to implement this as well
- 00:14:41okay or keep it keep this as your first
- 00:14:44approach so that you can say that we
- 00:14:46have used Docker as agent in our Jenkins
- 00:14:49project setup and we found this as very
- 00:14:52useful in terms of cost and also in
- 00:14:54terms of efficiency and you know
- 00:14:57spinning up and tearing down the docker
- 00:14:59containers perfect now this is the
- 00:15:01architecture that I wanted to explain
- 00:15:03you and in today's class we will see the
- 00:15:05approach to and I'll also explain you
- 00:15:07how to configure this Docker containers
- 00:15:10and how to use Docker as agent
- 00:15:12it's going to be very simple don't worry
- 00:15:14about it
- 00:15:15perfect so now what we need to do is
- 00:15:18that we have Jenkins installed and we
- 00:15:20are also able to access Jenkins
- 00:15:22to configure Docker first of all you
- 00:15:24have to have Docker installed on the
- 00:15:27same machine I mean right now in this
- 00:15:29class I'm only going to use one ec2
- 00:15:31instance so I am not going to create
- 00:15:33multiple ec2 instances so what I'll do
- 00:15:35is I'll use the same instance whereas
- 00:15:37Jenkins Jenkins is installed and an
- 00:15:39install Docker on this machine so for
- 00:15:42installing Docker again you can follow
- 00:15:44my document and you can directly copy
- 00:15:46the steps that is firstly you uh apt
- 00:15:49install Docker dot IO right so let me
- 00:15:52copy the commands from here itself you
- 00:15:55don't have to do sudo apt update one
- 00:15:56more time if you have already done so
- 00:15:58I'll just say sudo apt install Docker
- 00:16:01dot IO
- 00:16:03so what I'm doing I'm installing Docker
- 00:16:06on the same machine you can also install
- 00:16:08on a different machine but you have to
- 00:16:09configure that machine as a slip
- 00:16:12okay so once I do it uh what is the
- 00:16:15thing uh I mean you also have to ensure
- 00:16:18that the docker demo so if you know
- 00:16:20about Docker Docker typically runs on a
- 00:16:23demon process that's a single process or
- 00:16:25single source of Truth for Docker and
- 00:16:27this demon process by default is not
- 00:16:30accessible to other other users so I've
- 00:16:33installed Docker using root so only root
- 00:16:35user has access to this demon so I have
- 00:16:38to Grant access to this Docker D1 so to
- 00:16:41do that what I'll do is uh Jenkins
- 00:16:44basically comes with a user called
- 00:16:45Jenkins user I'll Grant the access to
- 00:16:48Jenkins user as well as the Ubuntu user
- 00:16:51as well just in case we want to use
- 00:16:52Ubuntu user so I have documented both of
- 00:16:55them firstly I am switching to the root
- 00:16:57user using sudo hyphen sudo hyphen and
- 00:17:01then user mod is used to Grant access to
- 00:17:04Jenkins like I'm just making it part of
- 00:17:06the docker group so Docker installation
- 00:17:09creates a group called Docker and
- 00:17:11whoever wants access access to this
- 00:17:13Docker demon or whoever wants to create
- 00:17:15containers or whoever wants to access
- 00:17:17the docker they should be part of the
- 00:17:19docker group so I'm just making them
- 00:17:21part of the docker group and I am
- 00:17:23restarting the docker demon
- 00:17:26so it it is done now if you see here I
- 00:17:29can switch to Jenkins user uh what I'll
- 00:17:32do is switch user
- 00:17:35Jenkins so right now I'm in Jenkins user
- 00:17:38Jenkins user is by default created when
- 00:17:40you are installing Jenkins software if I
- 00:17:43try to do what is a Docker hello welcome
- 00:17:45and you can simply say Docker run hello
- 00:17:48world this will ensure that your Docker
- 00:17:51is installed and the user has access to
- 00:17:53Docker like if you see here right now it
- 00:17:55is saying that okay the demon does not
- 00:17:58have access I mean Jenkins does not have
- 00:18:00access to the demon let us see what is
- 00:18:02happening let me just log out to this
- 00:18:05user and let me again Grant the access
- 00:18:07maybe I fumbled with the command let me
- 00:18:10say user mod
- 00:18:13minus aging Docker is a group and then
- 00:18:16Jenkins is the user let me see if I
- 00:18:19granted the required access or not
- 00:18:23switch user hyphen Jenkins and uh let me
- 00:18:27say
- 00:18:30Docker run
- 00:18:33hello world
- 00:18:36yes so if you see here maybe the demon
- 00:18:39was getting restarted because I used the
- 00:18:41restart command as well maybe the demon
- 00:18:43was getting restarted or maybe I clicked
- 00:18:46on the wrong command one of these things
- 00:18:47but never mind so now Jenkins user is
- 00:18:50also able to create the containers or
- 00:18:52run the containers that is what the
- 00:18:54requirement was okay so if you look at
- 00:18:56the document Grant Jenkins user and
- 00:18:58Ubuntu user permissions to Docker demand
- 00:19:01why did I grant to Ubuntu user as well
- 00:19:03because some people might want to use
- 00:19:04Jenkins with the Ubuntu user or you know
- 00:19:06they might run into some issues so
- 00:19:08instead I said okay Grant Ubuntu user as
- 00:19:10well now the other thing that you have
- 00:19:12to do is because Jenkins sometimes okay
- 00:19:15it does not happen every time sometimes
- 00:19:17Jenkins might not pick up these changes
- 00:19:19so just restart your Jenkins okay so to
- 00:19:22restart your Jenkins just go to your
- 00:19:24Jenkins URL click on slash and just type
- 00:19:27restart
- 00:19:29okay then you will see a pop-up called
- 00:19:31are you sure you want to restart Jenkins
- 00:19:33just say yes
- 00:19:35okay so your Jenkins is restarted the
- 00:19:38reason why I'm doing is sometimes uh
- 00:19:39Jenkins might not pick up the changes or
- 00:19:42your Jenkins might be created a long
- 00:19:43time and there might be some caching so
- 00:19:45it is a good practice to restart your
- 00:19:48Jenkins or uh whenever you install some
- 00:19:50Jenkins plugins you will anyways restart
- 00:19:52your Jenkins so that uh you don't have
- 00:19:54to do it now anything is fine
- 00:19:57so I'll just wait for the Jenkins
- 00:19:59instance to come up again it will not
- 00:20:01take much time now if you see here it
- 00:20:03hardly took two seconds now
- 00:20:05login to your Jenkins so if you did not
- 00:20:08create the password previously it would
- 00:20:10be difficult for you so always create
- 00:20:13your password user ID and password
- 00:20:16right now
- 00:20:18we are done with installing Docker here
- 00:20:20right so we install Docker here now the
- 00:20:23next step that you do is once you once
- 00:20:26you install Docker the other thing that
- 00:20:27you have to do is you have to install
- 00:20:29the docker plugin inside this Jenkins
- 00:20:32okay so why you have to install Docker
- 00:20:35pipeline plugin is like you know to run
- 00:20:38Docker as agent Jenkins should
- 00:20:41understand that okay whenever I'm
- 00:20:42executing a job I have to make sure that
- 00:20:45if the user provides in the Jenkins file
- 00:20:47to run this uh specific job on Docker uh
- 00:20:51I I need to have the configuration so
- 00:20:53that's the reason why you will install
- 00:20:54the docker pipeline so that Jenkins will
- 00:20:57execute your pipelines on Docker agent
- 00:20:59if the required configuration is
- 00:21:01provided in the Jenkins file so again
- 00:21:04let me come here click on dashboard
- 00:21:08you will see manage Jenkins click on
- 00:21:10manage Jenkins
- 00:21:12once you click on manage Jenkins so if
- 00:21:14you are using old version of Jenkins you
- 00:21:16will see manage notes if you are using
- 00:21:17new version of gen games you will see
- 00:21:18manage nodes and clouds so click on
- 00:21:21manage nodes and clouds uh sorry clouds
- 00:21:23after that what you will do is
- 00:21:26you have to oh sorry my bad uh go to
- 00:21:30manage Jenkins and you have to go to
- 00:21:31manage plugins not manage nodes uh sorry
- 00:21:35for that just click on manage plugins
- 00:21:37and install the docker pipeline plugin
- 00:21:40okay so search for Docker pipeline
- 00:21:42plugin in the available plugin section
- 00:21:45again uh just to mention that everything
- 00:21:47is part of the document if you are not
- 00:21:49able to follow the video you can also
- 00:21:51follow my GitHub repository where I have
- 00:21:54provided all these details okay so fork
- 00:21:57or clone the repository or start the
- 00:21:58Repository
- 00:22:00so docker pipeline
- 00:22:03so this is the docker pipeline plugin
- 00:22:05either you can click on install without
- 00:22:07restart or download now and install uh
- 00:22:10after restart anything is fine okay but
- 00:22:12what you need to do is once these
- 00:22:14plugins are installed there are three
- 00:22:16plugins that are getting installed okay
- 00:22:18it said download it successfully will be
- 00:22:20activated during your next boot that is
- 00:22:23during your next start or restart so
- 00:22:25that's the reason why again you need to
- 00:22:26restart your Jenkins okay so uh don't
- 00:22:29get frustrated while you are restarting
- 00:22:31Jenkins too many times so it is required
- 00:22:34if you are not restarting your Jenkins
- 00:22:36your changes might not get reflected and
- 00:22:39you know somewhere down the line you run
- 00:22:41into some issue and you never understand
- 00:22:43what is the issue so that's why always
- 00:22:45try to restart the Jenkins
- 00:22:48so like you see uh it it will not take
- 00:22:50much time it will hardly take some uh
- 00:22:53five to ten seconds so don't worry about
- 00:22:55it
- 00:22:58perfect again I'll just provide the
- 00:23:01password and username
- 00:23:03now everything is configured and
- 00:23:06installed so we can proceed with writing
- 00:23:08our first Jenkins pipeline okay so for
- 00:23:11the viewers let's say somebody is very
- 00:23:13new to Jenkins what you need to do is
- 00:23:15just click on new item okay then there
- 00:23:17are multiple ways of creating Jenkins
- 00:23:19pipelines so you can create a freestyle
- 00:23:21project you can create a pipeline
- 00:23:23project multi configuration project
- 00:23:25multi-branch pipeline organization
- 00:23:27folder is just a folder that you want to
- 00:23:29create but why you have so many
- 00:23:32varieties of it so if uh like you know
- 00:23:35if you go back uh five years or ten
- 00:23:37years there was only freestyle project
- 00:23:39okay all that you can do was only a
- 00:23:41freestyle project where you provide
- 00:23:42everything as part of your uh like I'll
- 00:23:45show you okay so if I just have to show
- 00:23:48you this one if you click on the
- 00:23:49freestyle project so everything can be
- 00:23:51provided in the input boxes okay so uh
- 00:23:55Jenkins used to provide these boxes
- 00:23:57where it it explains you like you know
- 00:23:58if if git then provide the details here
- 00:24:01if you want to provide anything else you
- 00:24:03gonna provide all the details here but
- 00:24:05what is happening or the the biggest
- 00:24:07drawback of this approach like even you
- 00:24:10might find this very comfortable for the
- 00:24:12users like let's say I'm a devops
- 00:24:13engineer I have to do zero coding here
- 00:24:15right everything is just a text boxes
- 00:24:17and I can just provide the repository
- 00:24:19URL of my GitHub or I can provide some
- 00:24:22credentials everything as part of the
- 00:24:23check boxes which is very easy for me
- 00:24:25but the problem is this is not a
- 00:24:27declarative approach right so what do I
- 00:24:30mean by declarative approach is
- 00:24:32this approach cannot be shared with the
- 00:24:34team members let's say if you're using a
- 00:24:36freestyle project and tomorrow morning
- 00:24:39somebody has modified uh or you know uh
- 00:24:42you want to only modify it by sending it
- 00:24:44by your peer review like if you're
- 00:24:46writing a calculator application in
- 00:24:48Python and you want to modify the
- 00:24:50addition functionality what you do is
- 00:24:52you would raise a pull request on GitHub
- 00:24:53and some of your peer will review it but
- 00:24:56in this approach the major drawback is
- 00:24:58that it cannot go through all of this
- 00:25:00workflow which is a workflow that is
- 00:25:01followed by most of the tools so to
- 00:25:03overcome this process and there are
- 00:25:05other drawbacks as well I'm just
- 00:25:06explaining one drawback
- 00:25:08so to overcome all of these problems
- 00:25:10Jenkins has come up with a pipeline
- 00:25:12approach now what is pipeline approach
- 00:25:14so if I just say
- 00:25:18first Jenkins job and let me select the
- 00:25:22pipeline okay so in the pipeline
- 00:25:24approach the biggest Advantage is you
- 00:25:26can write a declarative or you can write
- 00:25:28a scripted pipelines so using
- 00:25:30declarative or scripted pipelines what
- 00:25:32happens is you can write your pipeline
- 00:25:34as code here like let's say I want to
- 00:25:37write a hello world or I just want to
- 00:25:39build a Jenkins plus Maven application
- 00:25:41so this is a draft like similarly you
- 00:25:44can write your own stages and you can
- 00:25:46write your own steps and you can put
- 00:25:48this entire thing in a git repository or
- 00:25:51in a GitHub repository and you can have
- 00:25:53it uh go through your peer reviews or
- 00:25:55you know you can always extend it
- 00:25:57whenever a new plugin is written you can
- 00:25:59simply modify the code and it is very
- 00:26:01easy right because we are all used to
- 00:26:03the code approach or we are all used to
- 00:26:05uh storing the code in GitHub getting
- 00:26:08through the review process seeing if
- 00:26:09anything is wrong and you know if you
- 00:26:12have any declarative model where you can
- 00:26:14see what is in your GitHub instead of
- 00:26:16logging into your Jenkins all the time
- 00:26:18go into this specific job if there are
- 00:26:20100 jobs you have to go to 100 jobs and
- 00:26:22see what is the configuration in each
- 00:26:24and every of this job but instead if you
- 00:26:26have things on GitHub or any Version
- 00:26:27Control System you can see not only uh
- 00:26:30all the Jenkins files uh today but you
- 00:26:33can also track the previous versions
- 00:26:34very easily right
- 00:26:36so that is the reason why we should
- 00:26:38always go with the pipeline approach
- 00:26:40like even if you are learning Jenkins
- 00:26:42today don't start with the freestyle
- 00:26:44project always start with the pipeline
- 00:26:45project itself now you might say that
- 00:26:47okay pipeline I have to write all of
- 00:26:49these code in groovy scripting I don't
- 00:26:51know groovy scripting don't worry uh
- 00:26:54that is what I am going to explain today
- 00:26:55in today's topic I'll try to make it as
- 00:26:58simple as possible and even after that
- 00:27:00if you have some problem I'll also show
- 00:27:02you some tips and tricks
- 00:27:03okay so firstly what we will do is we'll
- 00:27:07start with the basic one in my GitHub
- 00:27:09repository that is writing my first
- 00:27:11pipeline right so this this folder uh I
- 00:27:14have three uh Jenkins projects for you
- 00:27:16today and the first one is my first
- 00:27:18pipeline
- 00:27:20so my first pipeline what does it say a
- 00:27:23simple Jenkins pipeline to verify if
- 00:27:25Docker slave configuration or Docker
- 00:27:27agent configuration actually it should
- 00:27:29be a Docker agent so if the docker agent
- 00:27:32configuration is working as expected or
- 00:27:34not so what I am doing in this Jenkins
- 00:27:36file is you know I am configuring Docker
- 00:27:39as agent and then in stages I am just
- 00:27:42verifying if uh you know the container
- 00:27:45has node.js or not because I'm using a
- 00:27:47node.js container
- 00:27:49so what is this pipeline what is the
- 00:27:51syntax and what is Agent and stages
- 00:27:54don't worry I'll try to explain you with
- 00:27:57a graphical representation or a
- 00:27:59diagrammatic representation
- 00:28:01so if you see here uh just give me one
- 00:28:04second
- 00:28:08uh if you go back here
- 00:28:11right so in the previous class also we
- 00:28:14discussed about it but uh I'll just take
- 00:28:16some time to explain for someone who is
- 00:28:18watching the video for the first time so
- 00:28:20if you see here
- 00:28:21Jenkins is all about picking up the code
- 00:28:25from your local development or in any
- 00:28:26version control system and delivering it
- 00:28:29to production or any uh like you know
- 00:28:31staging environment or somewhere where
- 00:28:33automating all the stages that are
- 00:28:35involved in between right so let's say
- 00:28:37if there are 10 stages your job and
- 00:28:39responsibility is to automate 10 stages
- 00:28:41in Jenkins so Jenkins has acts as an
- 00:28:44orchestrator even if you look at uh the
- 00:28:46example here like you know Jenkins is
- 00:28:48providing a sample uh click on GitHub
- 00:28:51plus Maven what it is doing is it is
- 00:28:53telling that there are multiple stages
- 00:28:55in these Jenkins and the first stage is
- 00:28:57the build stage okay so what it is doing
- 00:29:00in build stage it is basically getting
- 00:29:02out the code from or checking out the
- 00:29:03code from GitHub after that it is
- 00:29:05executing a maven Target then you know
- 00:29:08it is uh verifying uh if the junit
- 00:29:11coverage is proper or not and what it is
- 00:29:14doing is it is just uh storing this J
- 00:29:16unit artifacts right so uh basically it
- 00:29:19gets some reports and it is trying to R
- 00:29:21archive that artifact reports and
- 00:29:24archive the artifact jar or the war
- 00:29:26which is created as an end output of
- 00:29:28this build process
- 00:29:31so this is one stage but in Jenkins as
- 00:29:34we talked in the previous class there
- 00:29:35can be multiple stages right for example
- 00:29:38here uh where is that my Jenkins
- 00:29:41pipeline yeah so if you see here there
- 00:29:43can be your SCM checkout which we just
- 00:29:45talked about then there can be build uh
- 00:29:47let's say your application is Java
- 00:29:49application so this stage might contain
- 00:29:51Maven right so you can build your
- 00:29:54application using Maven then you might
- 00:29:56have a test stage and as part of test
- 00:29:58stage you can run some functional
- 00:30:00testing you can run some code quality
- 00:30:02testing or you can integrate with some
- 00:30:04external code scanning or code security
- 00:30:06related tooling then you finally deploy
- 00:30:09this onto a Docker container or you
- 00:30:12deploy it onto Docker spam or you deploy
- 00:30:15it onto kubernetes whatever the platform
- 00:30:17that you would like to and finally once
- 00:30:19you store all of this test results and
- 00:30:21once you store all of this artifacts
- 00:30:23then you know you finally deliver the
- 00:30:25code or the application to customer
- 00:30:27right so this is the end to end and this
- 00:30:30stages can increase right here in this
- 00:30:32example there are four stages stage one
- 00:30:34stage two stage three and stage four
- 00:30:36depending upon organization to
- 00:30:38organization
- 00:30:40this stages will increase right so the
- 00:30:43stages can increase but the entire
- 00:30:45skeleton of your Jenkins pipeline is
- 00:30:47always the same like for example if you
- 00:30:49if you look at the example that I
- 00:30:51provided here so in this example I just
- 00:30:54have one stage right I said stages and
- 00:30:56inside stages I said that this is a test
- 00:30:59stage and there is only one step in the
- 00:31:01stage step is nothing but the comments
- 00:31:03that you want to execute are like you
- 00:31:05know you can split your stage into
- 00:31:07multiple steps if your stage is
- 00:31:09complicated so I said there is only one
- 00:31:11stage and inside the stage there is only
- 00:31:13one step let's see the example that
- 00:31:15Jenkins is providing so here what is
- 00:31:18happening there is again one stage but
- 00:31:20inside that one stage you have two
- 00:31:23different steps so tomorrow if you have
- 00:31:25three steps what you will do is just
- 00:31:26you'll you'll just write one more step
- 00:31:28right so you said steps here you keep on
- 00:31:31increasing the steps but the entire
- 00:31:33skeleton is same don't worry that okay
- 00:31:35I'm very new to uh groovy scripting I
- 00:31:38don't know how groovy scripting works so
- 00:31:39just take take any example if you if you
- 00:31:42start working in an organization you can
- 00:31:44look at the previous Jenkins files or
- 00:31:46you know you can also take uh help here
- 00:31:49like I showed you this is a Hello World
- 00:31:51program
- 00:31:52so you can start learning from the hello
- 00:31:54world you can start learning from my
- 00:31:55repository and there is also one more
- 00:31:57flexibility that is
- 00:32:00Jenkins provide you pipeline syntax so
- 00:32:02pipeline syntax is a very good utility
- 00:32:05let's say I don't know the Syntax for
- 00:32:07checking out the code from GitHub like
- 00:32:09if you see here what this project is
- 00:32:12doing here uh where is this one like if
- 00:32:14you go back here what GitHub plus Maven
- 00:32:18example project is doing is it is
- 00:32:20checking out the code from GitHub now
- 00:32:22you might say that Abhishek I don't know
- 00:32:23Syntax for this now how do I write this
- 00:32:25one I know I can Google it but is there
- 00:32:27any way so the easy way is just go to
- 00:32:29this pipeline syntax and search for the
- 00:32:31option whatever you want to write so
- 00:32:33here I want to write for git I want to
- 00:32:35check out code from git so it is saying
- 00:32:37okay just provide me the repository URL
- 00:32:39so I'll say this is just a dummy one
- 00:32:42okay I'll say uh github.com Slash uh
- 00:32:46Argo proj slash Argo hyphen CD let's say
- 00:32:50and the Brand's name I want to create
- 00:32:52Jenkins pipeline for main branch for
- 00:32:54example or let it be Master branch and
- 00:32:56finally I can provide some credentials I
- 00:32:59did not save any credentials in this
- 00:33:00Jenkins but if there is some credentials
- 00:33:01that are shown just run on generate
- 00:33:03pipeline script so this is the script
- 00:33:05you can just copy it and you can put it
- 00:33:07in on Pipeline after that let's say I
- 00:33:10want to run couple of shell scripts so
- 00:33:12what I need to do is I can search for
- 00:33:13shell script option here search for
- 00:33:15shell script and it will ask what are
- 00:33:16the shell scripts that you want to run
- 00:33:18I'll say just CD to a folder called Foo
- 00:33:20and run a script called as hack
- 00:33:25test dot sh okay so just again run the
- 00:33:28pipeline script and it will give you how
- 00:33:30to use this as syntax in your Jenkins
- 00:33:33pipeline so Jenkins has all of these
- 00:33:36things in the Jenkins groovy code
- 00:33:37generator so code generator is a utility
- 00:33:39that will be your first savior so if you
- 00:33:42want to learn Jenkins use this code
- 00:33:45generator for writing your Jenkins
- 00:33:47Pipelines
- 00:33:48now I've discussed a lot about this uh
- 00:33:51how to write this Jenkins scripts and
- 00:33:54what are some of the tips and tricks now
- 00:33:56let us proceed with our pipeline the
- 00:33:58first pipeline for the day and I will
- 00:34:00show you how to execute this pipeline
- 00:34:02all that you need to do is you because I
- 00:34:05already have a Jenkins file you don't
- 00:34:07even have to write the Jenkins file and
- 00:34:08everything just go to the specific
- 00:34:10folder okay and what you will do is come
- 00:34:13to your first Jenkins job okay remove
- 00:34:15everything say instead of pipeline
- 00:34:18script say pipeline script from sem that
- 00:34:21is
- 00:34:21instead of me writing the pipeline
- 00:34:24script I want to pick up a pipeline
- 00:34:26script from source code management
- 00:34:27repository that is GitHub repository so
- 00:34:30Jenkins will say okay tell me what is
- 00:34:32the repository of that uh SCM so here
- 00:34:35you can say go to again this folder and
- 00:34:37you can copy either from here or from
- 00:34:39the code section you can say okay so
- 00:34:41this is My URL after that if you have
- 00:34:44any credentials like mine is not a
- 00:34:46private repository so I don't have any
- 00:34:48credentials and then you can say is your
- 00:34:50branch master or main let us see if it
- 00:34:53is master or main so it is a main branch
- 00:34:56change the branch domain then what is
- 00:34:59the path uh is it present in the root no
- 00:35:02it is actually present inside a folder
- 00:35:04called my first pipeline so what you'll
- 00:35:06do is copy this my first pipeline okay
- 00:35:09and append it in front of like you know
- 00:35:11prefix your Jenkins file with this one
- 00:35:13so say my first pipeline slash Jenkins
- 00:35:16file now save this one
- 00:35:18okay once you save this you will start
- 00:35:21seeing the entire concept that I just
- 00:35:23told you like right now there is only
- 00:35:26one ec2 instance if you see here there
- 00:35:28is only one ec2 instance I don't have
- 00:35:30worker nodes now where is this Jenkins
- 00:35:32pipeline going to be executed because I
- 00:35:34told you Jenkins master or ec2 instance
- 00:35:37is mostly used for the scheduling
- 00:35:40purpose but now where is this pipeline
- 00:35:41going to run so you will see the magic
- 00:35:43whenever when I run the build now option
- 00:35:47so as I click on the build no option
- 00:35:49what happens is this particular Jenkins
- 00:35:52will start looking like firstly of
- 00:35:54course it will fetch the code from
- 00:35:56GitHub okay so it said that okay I am
- 00:35:59fetching the code from GitHub this is
- 00:36:00all the git commands that it is
- 00:36:01executing and after that if you see here
- 00:36:04it is pulling an image called node colon
- 00:36:0716 hyphen Alpine so firstly try to see
- 00:36:10if there is any Docker container or if
- 00:36:12there is any Docker image on that
- 00:36:14specific node okay or on that Jenkins
- 00:36:17Master it did not find so what it did is
- 00:36:19it tried to create one Jenkins sorry
- 00:36:22Docker image it executed the entire
- 00:36:24pipeline so the pipeline is very simple
- 00:36:26one it just executes node hyphen version
- 00:36:28because this is my first Jenkins
- 00:36:30pipeline where I just want to see if
- 00:36:32entire configuration is correct or not
- 00:36:33that's it
- 00:36:34I didn't want to do anything so here I
- 00:36:37verified that my node version is correct
- 00:36:39and what Jenkins is doing here is this
- 00:36:42is the uh I mean this is a very
- 00:36:44important thing once the execution is
- 00:36:46done okay once the entire pipeline is
- 00:36:48successful or the build is successful
- 00:36:49Jenkins just said that delete the docker
- 00:36:52container okay so now if you see like
- 00:36:55this is my instance right if I come here
- 00:36:56and say Docker PS you'll notice that
- 00:36:58there is no running container and
- 00:37:01if I do docker
- 00:37:04PS hyphen a
- 00:37:06you will see that okay so this is the
- 00:37:08hello world container that I just showed
- 00:37:10you right to verify the docker
- 00:37:12installation so you can ignore this one
- 00:37:13because this is just something that I
- 00:37:15showed you for Docker installation but
- 00:37:17there are no containers as well that
- 00:37:19means Docker what it did is if you go
- 00:37:21back to the previous diagram so
- 00:37:25Jenkins requested Docker to create one
- 00:37:28container okay so using the docker
- 00:37:30pipeline plugin that we configured you
- 00:37:32talk to the docker and it said okay can
- 00:37:34you give me one container so that I can
- 00:37:36execute my pipeline that is a node.js
- 00:37:39related application Docker said okay uh
- 00:37:41I'll give you a container called C1 now
- 00:37:43Jenkins executed uh this on C1 and as
- 00:37:46soon as the process is done it just
- 00:37:48terminated the C1 okay so that means
- 00:37:50even though you see the diagram like
- 00:37:52this but it is always that you know
- 00:37:55there are no running containers at all
- 00:37:57only when there is a request a container
- 00:38:00is created okay so the actual diagram
- 00:38:02would be only when there is a request a
- 00:38:05container is created right so this is
- 00:38:08the approach so this is how you are
- 00:38:10saving a lot of cost and you are saving
- 00:38:12uh not not just the cost okay even if
- 00:38:14you say that okay my organization is not
- 00:38:16worried about the cost but the major
- 00:38:18advantage is that if we go back to the
- 00:38:20VMS approach
- 00:38:22you have a major challenge with managing
- 00:38:24the dependencies upgrading these virtual
- 00:38:26machines like uh let's say today you are
- 00:38:28using Centos 7. so all of these worker
- 00:38:31nodes or Centos 8 and tomorrow you want
- 00:38:33to upgrade all of these worker nodes to
- 00:38:35send OS 9. so technically there has to
- 00:38:38be a devops theme that is managing this
- 00:38:40worker nodes as well right and today you
- 00:38:42are using node.js 14. tomorrow you want
- 00:38:45node.js 15. so somebody has to log into
- 00:38:48these virtual machines and they have to
- 00:38:49update the node.js version any
- 00:38:51dependencies are there they have to
- 00:38:52update the dependency versions as well
- 00:38:54if there is any security related
- 00:38:55concerns they have to update that
- 00:38:57packages package.json lot of things
- 00:38:59right whereas if you look at my
- 00:39:01configuration here only thing that you
- 00:39:03need to do is just go to this specific
- 00:39:06file and from Note 7 16 Alpine just
- 00:39:10change it to node 17 Alpine that's it
- 00:39:12you just have to change two magical
- 00:39:14letters and your entire configuration is
- 00:39:16done so this is the advantage of using
- 00:39:19Docker as agent now you might say that
- 00:39:21okay I am expecting to write a big
- 00:39:23Jenkins pipeline but you just shared me
- 00:39:25the steps to write a very simple one but
- 00:39:27I'm actually interested in writing a big
- 00:39:29one so the only difference that you do
- 00:39:31is write uh you don't have to worry
- 00:39:34about anything just come here keep
- 00:39:36adding stages okay so this is one stage
- 00:39:39right what you do after this is add one
- 00:39:41more stage add one more stage and
- 00:39:43instead of test stage you might call
- 00:39:46this stage as deploy and what you are
- 00:39:48doing in this specific stage is probably
- 00:39:50you are saying Cube CTL apply minus F at
- 00:39:54deployment.aml file or probably you are
- 00:39:57uh you know adding one more step for
- 00:39:59sonar you are adding one more step so
- 00:40:02here Jenkins pipeline is never
- 00:40:04complicated unless you are not using a
- 00:40:07write syntaxes or you know unless you
- 00:40:09are not using uh proper semantics
- 00:40:12no I am not going to stop it here but
- 00:40:15actually I am going to show you lot of
- 00:40:17other things like okay this is just a
- 00:40:20simple Jenkins pipeline now if you
- 00:40:22understood how to do it okay so if you
- 00:40:24are clear till now just click on the
- 00:40:26like button also uh share your feedback
- 00:40:29to me in the comment section so that I
- 00:40:30understand okay till this timestamp
- 00:40:32everybody is clear okay I'm expecting
- 00:40:34things are clear right now
- 00:40:37after this let us see how to create a
- 00:40:40multi-stage multi-agent job now what is
- 00:40:42multi-stage and what is multi-agent
- 00:40:44don't worry about the name so my
- 00:40:46intention is that like in the previous
- 00:40:48example I just showed you one node.js
- 00:40:50application how to deploy it but many
- 00:40:53people are asking me that Abhishek in my
- 00:40:55architecture or in my current
- 00:40:57organization we are using application
- 00:40:59with database and we have a three Tire
- 00:41:02application basically I have front end I
- 00:41:04have backend and I have database now
- 00:41:06database related cicd has to be executed
- 00:41:09on let's say uh on a VM that has Centos
- 00:41:12whereas front-end and back-end
- 00:41:15applications has to be implemented on
- 00:41:17virtual machine that has Ubuntu okay or
- 00:41:19that has Java installed and in the back
- 00:41:21end I just want Oracle installed now how
- 00:41:24do I solve this problem right because if
- 00:41:26you start using worker nodes then this
- 00:41:28becomes very complicated and during
- 00:41:30during your interviews uh they are
- 00:41:32saying that okay this is not the right
- 00:41:33approach so the right approach would be
- 00:41:36okay so to create multiple stages and
- 00:41:39like you know here I said agent has none
- 00:41:41if you if you look at the previous
- 00:41:43example I said agent as Docker here but
- 00:41:45here what I did is I said agent as none
- 00:41:48and inside the stages I mentioned like
- 00:41:51okay if it is a back end stage okay use
- 00:41:53a maven or use Java okay and if it is
- 00:41:57front end use node or react and if it is
- 00:42:00uh database related thing use any image
- 00:42:02that has Oracle pre-installed in it or
- 00:42:05whenever a container is created then it
- 00:42:07has Oracle or MySQL or anything that is
- 00:42:09already installed so what you can do if
- 00:42:11it is a three-time architecture
- 00:42:14okay probably for front end you might be
- 00:42:17using node.js for backend you might be
- 00:42:19using uh Java with Maven and for
- 00:42:22database okay so what I'll do is I'll
- 00:42:24just copy the things from here to here
- 00:42:28and I'll add one more stage here
- 00:42:33oh my bad
- 00:42:35okay and here I'll say
- 00:42:39database and the image I'll just change
- 00:42:42it to mySQL okay so MySQL let me call it
- 00:42:46as latest okay I'll say my my SQL latest
- 00:42:48never use latest always use image that
- 00:42:51is required the image stack that is
- 00:42:53required but let's say MySQL column
- 00:42:55latest and inside the steps I'll I'll
- 00:42:57run some I SQL related queries or you
- 00:42:59know I'll do some DB related migrations
- 00:43:01or I'll run some joint queries or
- 00:43:03whatever is required here okay so select
- 00:43:05just for an example here okay select
- 00:43:07star from
- 00:43:10x y z okay so this is how you even
- 00:43:14manage multi-tier architecture
- 00:43:16applications okay so you can run this
- 00:43:18pipeline again as is do not save
- 00:43:20anything uh like I'm just providing the
- 00:43:23skeletons like I told you you can force
- 00:43:24this repositories and you can play with
- 00:43:27your applications like you know you can
- 00:43:28uh instead of Maven uh 3.8 you can just
- 00:43:31change it to 3.9 or you can use any
- 00:43:34dummy Java application and you can use
- 00:43:35the same pipeline okay you don't have to
- 00:43:37change anything just bring some Java
- 00:43:39hello world code you can find it
- 00:43:41anywhere in the internet just add that
- 00:43:43Java hello world code to this repository
- 00:43:45and run the maven targets okay and run
- 00:43:48the node.js related things like bring
- 00:43:50one node.js dummy application and run
- 00:43:51the node.js you can you can build your
- 00:43:54uh own pipelines by using this
- 00:43:56repository as your skeleton so now let
- 00:43:59me also try to
- 00:44:01execute this Pipeline and show you now
- 00:44:04what should happen is if you are
- 00:44:05executing this pipe
- 00:44:10you should be able to see that two
- 00:44:13containers are created okay like I told
- 00:44:15you the containers will be deleted but
- 00:44:17this time what I'll show you is using
- 00:44:19the terminal like whenever I start
- 00:44:20executing this pipeline
- 00:44:22I'll show you that
- 00:44:24um you know the containers are created
- 00:44:27dynamically and inside one container May
- 00:44:29when targets are running and inside one
- 00:44:31container your node.js related targets
- 00:44:33are running so in real in real life
- 00:44:35scenarios instead of Maven hyphen
- 00:44:37version you would actually use mvn clean
- 00:44:39install mvn package or any Maven related
- 00:44:42targets and here
- 00:44:44instead of node hyphen iPhone version
- 00:44:46you would be using something called as
- 00:44:48npm run or npm install or any any of the
- 00:44:51targets related to npm
- 00:44:54right so let me
- 00:44:56use the same Jenkins job okay so instead
- 00:44:59of creating a new Jenkins Zone what I
- 00:45:01will do is I'll use the same Jenkins job
- 00:45:03but I'll try to modify the SCM related
- 00:45:05targets that is here
- 00:45:08the repository name will be the same but
- 00:45:10the folder of my Jenkins file is the
- 00:45:12only one that will change okay what is
- 00:45:14the name of the folder here
- 00:45:16multi-stage multi-agent
- 00:45:20why I am calling it as multi-agent
- 00:45:22because here I am using multiple Docker
- 00:45:25containers
- 00:45:26uh not this one here yeah so I'm using
- 00:45:29multiple Docker containers dedicated to
- 00:45:31the uh usage like uh if you want for
- 00:45:35front and one Docker container for
- 00:45:36backend one Docker container and for DB
- 00:45:38related one Docker container
- 00:45:41let me save it
- 00:45:42okay and let me execute it
- 00:45:46so as soon as I execute it you will see
- 00:45:48that a new uh
- 00:45:50Jenkins pipeline is running now let me
- 00:45:52run Docker PS and show you what is
- 00:45:55happening okay till now it is not
- 00:45:57created let us give it one more uh
- 00:46:00few more seconds so till now I think it
- 00:46:03is just picking up the uh code from the
- 00:46:05GitHub repository
- 00:46:09I think now it is getting created
- 00:46:12yeah if you see here the maven related
- 00:46:14container is created and after that you
- 00:46:16will also see uh you see see here the
- 00:46:19node related container is created that
- 00:46:21means your first job got executed right
- 00:46:24and then uh sorry your first stage got
- 00:46:27executed and after that your second
- 00:46:28stage also got executed that means both
- 00:46:31your stages are executed and if you see
- 00:46:33here now the docker containers are
- 00:46:35terminated isn't it amazing so this
- 00:46:37should be your organization architecture
- 00:46:40right if your organization is using VM
- 00:46:43based approach you should always look at
- 00:46:45migrating them to this Docker container
- 00:46:47based approach you should suggest this
- 00:46:49architecture in your organization so
- 00:46:51that you not only save the cost but you
- 00:46:53are also saving a lot of time for your
- 00:46:55organization because
- 00:46:57if you look at the Legacy jobs okay
- 00:47:00let's say here instead of the docker
- 00:47:02containers we are using VMS so what will
- 00:47:04happen is you are technically
- 00:47:06maintaining two VMS so you are
- 00:47:08maintaining a VM for Maven you are
- 00:47:10maintaining a VM for node.js and
- 00:47:11whenever the node.js version is
- 00:47:13increased you have to go to that VM and
- 00:47:15you have to increase that Maven version
- 00:47:16in that VM and if the node.js version is
- 00:47:19increased you have to increase that if
- 00:47:21the base image of the ec2 instance is
- 00:47:24seen you either have to terminate that
- 00:47:26instance create a new one or inside that
- 00:47:28instance itself you have to update so
- 00:47:30there is a lot of Maintenance activity
- 00:47:32for the devops engineers and using this
- 00:47:34approach we are avoiding that
- 00:47:35maintenance activity
- 00:47:37right
- 00:47:39I hope that things are clear till now so
- 00:47:41this is how I I mean I just showed you
- 00:47:43two examples uh one is your first
- 00:47:45Jenkins Pipeline and then you have your
- 00:47:47multi-stage multi-agent now the
- 00:47:50assignment would be I'll be interested
- 00:47:52if somebody can enhance this one and
- 00:47:54create a pull request like you know add
- 00:47:56one more folder Fork this repository add
- 00:47:58one more folder and you know show me
- 00:48:01that Abhishek I just use your uh
- 00:48:03examples and what I did was instead of
- 00:48:06Maven hyphen f inversion and node hyphen
- 00:48:09iPhone version I actually created an
- 00:48:11application like it can be simple hello
- 00:48:12world as well so submit a Java hello
- 00:48:15world application submit a node.js hello
- 00:48:17world application and try to execute the
- 00:48:19targets instead of mbn hyphen F1 version
- 00:48:22just change it to mbn install ambient
- 00:48:24clean installer mvn package and here
- 00:48:26just try to change it to npm install and
- 00:48:28uh like you know it can be hardly it
- 00:48:31will take five minutes okay you can just
- 00:48:32find a search for even ask that GPT to
- 00:48:35give me a Java hello world Java class
- 00:48:38and put that in the repository and try
- 00:48:41to execute using Jenkins pipeline
- 00:48:43now we'll come to the complicated topic
- 00:48:46for today and that is how to set up CI
- 00:48:48CD the same I mean we'll use the cicd
- 00:48:52flow in this case I also wrote an
- 00:48:54application I mean I just used an
- 00:48:56existing application I did not write it
- 00:48:57so this is my existing python
- 00:49:00application okay we uh if you watch my
- 00:49:03previous kubernetes videos we use the
- 00:49:05to-do application so this is my to-do
- 00:49:06application and what I am trying to do
- 00:49:08is I am trying to implement this
- 00:49:10architecture for you okay so many people
- 00:49:13have asked me this one okay Abhishek how
- 00:49:15do I do this like you know I want to
- 00:49:17deploy my artifacts onto kubernetes
- 00:49:19directly
- 00:49:20I want to create a Jenkins pipeline
- 00:49:22which says end to end right from
- 00:49:24checking out the code to deploying the
- 00:49:25artifacts onto kubernetes
- 00:49:28so I have seen many people instead of
- 00:49:30Argo CD using ansible here okay so I'm
- 00:49:33not against the approach of using
- 00:49:35ansible or I'm not uh like you know
- 00:49:38saying that everybody has to use Argo CD
- 00:49:40but the point is Argo CD is a modern day
- 00:49:43uh continuous delivery like it's a
- 00:49:45declarative continuous delivery
- 00:49:46application and if you use Argo CD it
- 00:49:49has the like you know it's a tool that
- 00:49:51is developed for continuous delivery
- 00:49:53okay ansible is a configuration
- 00:49:54management Tool uh I mean by luck or by
- 00:49:58any anyways it can actually deploy the
- 00:50:00code onto your kubernetes clusters but
- 00:50:03Argo CD can not only just deploy but it
- 00:50:06it can also monitor the state inside
- 00:50:08your kubernetes cluster let's say
- 00:50:10in your GitHub okay what you are doing
- 00:50:13is you are saying that I want uh Foo dot
- 00:50:17uh I mean your application is full and
- 00:50:19you have version 3 of your full
- 00:50:21application so if you are using ansible
- 00:50:22ansible just deploys uh whatever you are
- 00:50:25storing it in Helm charts or whatever
- 00:50:26you are storing in the deployment.yaml
- 00:50:29files it will just pick up and it will
- 00:50:31just deploy under your kubernetes
- 00:50:32cluster but if you are using Argo CD or
- 00:50:34flux or Spinnaker any of the continuous
- 00:50:36delivery uh declarative continuous
- 00:50:38delivery tools or github's tools what
- 00:50:41they do is they will ensure that the
- 00:50:44state is always the same because they
- 00:50:45are kubernetes controllers so they are
- 00:50:47actually deployed in your kubernetes
- 00:50:49cluster itself now without wasting any
- 00:50:51time I'll show you how to do this so
- 00:50:53this is a simple python based
- 00:50:55application so this is a to-do
- 00:50:57application and if you deploy the
- 00:50:58application uh you will see uh the
- 00:51:01application like this so it will just
- 00:51:02have a simple UI and I also explained
- 00:51:06the implementation everything in the
- 00:51:08previous examples but if you want to try
- 00:51:10it by yourself just run this Docker file
- 00:51:13all that you need to do is just say
- 00:51:15Docker run minus ID and the docker file
- 00:51:19it will run the application on your
- 00:51:21localhost and you can directly see the
- 00:51:23application on your localhost like this
- 00:51:25now the idea or the point is to
- 00:51:28implement the entire thing in Jenkins
- 00:51:30Pipeline and to deploy that onto
- 00:51:32kubernetes cluster so if you want to uh
- 00:51:36watch the video from 0 to the end to end
- 00:51:39I already have the video on my YouTube
- 00:51:41channel so I put the link here where
- 00:51:43I'll do the exact same thing like you
- 00:51:45know I'll create a Jenkins pipeline that
- 00:51:47will watch for GitHub repository and
- 00:51:49then you know I'll try to build the
- 00:51:51application that is the python
- 00:51:53application I'll try to put this python
- 00:51:55application artifact that is a Docker
- 00:51:57container I'll try to push them to
- 00:51:58GitHub and I'll also paralleling update
- 00:52:01the deployment.dml file inside the
- 00:52:03GitHub and Argo CD if you see here the
- 00:52:07arrow is actually pointing towards
- 00:52:08GitHub okay or it is pointing towards
- 00:52:10Jenkins not from Jenkins to argosity
- 00:52:12that means Argo CD will watch for any
- 00:52:15change in GitHub it understands that
- 00:52:17okay there is a new version of to-do
- 00:52:18application and it will automatically
- 00:52:20pick up and deploy the application onto
- 00:52:21kubernetes so the entire thing I think
- 00:52:24it's a 30 minutes video and the entire
- 00:52:26video is present here but today I'll
- 00:52:27explain you how to do it like you know
- 00:52:30what is the application flow how to
- 00:52:31write Jenkins file for it
- 00:52:34so like I explained you can also choose
- 00:52:36Docker container as agent all that you
- 00:52:39need to do is simply agent hyphen Docker
- 00:52:41and provide the python version like like
- 00:52:44we provided node.js and Maven version
- 00:52:46you can provide a Docker image is equals
- 00:52:49to python 3.
- 00:52:50once you're done with it what I am
- 00:52:52firstly doing is I am writing a checkout
- 00:52:54stage inside this checkout stage I have
- 00:52:56a single step that is checking out the
- 00:52:59python code from sem that is source code
- 00:53:01management after that we are trying to
- 00:53:04build Docker I mean I am trying to
- 00:53:06actually build a Docker image for this
- 00:53:07application like I mentioned here it's
- 00:53:09just Docker build and then I'll push
- 00:53:12this Docker image to Docker Hub and
- 00:53:16finally what I'll do is I'll try to
- 00:53:19update the deployment.yaml okay so the
- 00:53:22deployment at ml is a kubernetes
- 00:53:24deployment file which is present here
- 00:53:26okay so inside the deployment folder I
- 00:53:29have a kubernetes deployment.yaml and
- 00:53:30service.yaml so I'll update this
- 00:53:33deployment.yaml with the new version
- 00:53:35that is created
- 00:53:37that is you know instead of version one
- 00:53:41let's say the build number is 2 what
- 00:53:43I'll do is uh Abhishek hyphen uh sorry
- 00:53:46Abhishek F5 hyphen to do hyphen app
- 00:53:49column
- 00:53:51build 35 or number 35 and what Argo CD
- 00:53:55will do is okay so I notice that there
- 00:53:58is change in this deployment.aml and for
- 00:54:00Argo CD git is always a single source of
- 00:54:03truth right so what Argo CD will do is
- 00:54:06it will watch for this specific change
- 00:54:07uh let me go back to that diagram
- 00:54:11yeah so what Argo CD will do is it will
- 00:54:14notice a change in git repository and it
- 00:54:16will deploy the applications onto
- 00:54:17kubernetes cluster so you can directly
- 00:54:20implement this one just uh like I always
- 00:54:22say just clone my repository and try to
- 00:54:25run this Jenkins file and Argo CD
- 00:54:27configuration you can watch from this
- 00:54:29video it will hardly take you five
- 00:54:30minutes you just have to install a
- 00:54:33kubernetes cluster it can be mini Cube
- 00:54:34or it can be k3s or anything and install
- 00:54:37Argo CD as an operator or as a simple
- 00:54:39binary and make sure your Argo CD is
- 00:54:42watching this repository I showed you
- 00:54:44the exact steps in the video that I
- 00:54:46mentioned here so you can follow the
- 00:54:47video as is okay so with that you will
- 00:54:50be able to set up the end to end Jenkins
- 00:54:52pipeline configuration setup and your
- 00:54:55deployment will be taking on the
- 00:54:56kubernetes cluster
- 00:55:07okay so this is about the uh kubernetes
- 00:55:10uh delivery or kubernetes cacd process
- 00:55:13now
- 00:55:14we'll move to the final topic for today
- 00:55:17that is Jenkins interview questions okay
- 00:55:20so I already covered the Jenkins
- 00:55:21interview questions again on my video
- 00:55:23but I'll explain you uh on brief what
- 00:55:26can be the interview questions on
- 00:55:27Jenkins
- 00:55:28so the first and foremost question uh
- 00:55:31that people would be interested is to
- 00:55:32understand your cicd process okay so you
- 00:55:35can explain the cicd process that I
- 00:55:36showed you here so you can just tell the
- 00:55:39exact same process but you can say uh
- 00:55:42depending upon your organization let's
- 00:55:44say you are using a Android or mobile
- 00:55:45application so you can slightly modify
- 00:55:48the steps here and say that for the
- 00:55:50build language I'm using Android build
- 00:55:53process or for Java applications I'm
- 00:55:55using Maven for
- 00:55:59for node.js applications I'm using npm
- 00:56:02so depending upon your application to
- 00:56:04application you can Define uh the stages
- 00:56:06but the standard flow will be you
- 00:56:08explain your cicd process as what we are
- 00:56:11doing is we are firstly checking out the
- 00:56:12code from uh sem when we are building
- 00:56:14the application then we test it for uh
- 00:56:17code vulnerabilities code code scanning
- 00:56:19static code analysis sash dashed and
- 00:56:22then you can finally say that we store
- 00:56:24the artifacts and we deploy them onto
- 00:56:26your kubernetes cluster for deployment
- 00:56:29we use Argo CD or if you are familiar
- 00:56:31with ansible you can also say
- 00:56:33for deployment we use ansible but if you
- 00:56:35are talking about argosity probably
- 00:56:36they'll think that okay you are using
- 00:56:38Advanced tooling so this will be your
- 00:56:40first first question that is explain the
- 00:56:43CI CD organ uh sorry cicd workflow in
- 00:56:45your organization once that is done then
- 00:56:48people will ask you like you know uh how
- 00:56:50do you handle issues in your worker
- 00:56:52nodes let's say uh you know you have
- 00:56:54your Jenkins jobs that are running on
- 00:56:56your worker notes so how do you handle
- 00:56:58these things
- 00:56:59uh your worker note is going down or
- 00:57:01your worker node is not responsive so
- 00:57:03what you will say is that you know I'll
- 00:57:05log into this worker node try to
- 00:57:07understand the problem uh I'll try to uh
- 00:57:10get the thread terms or you know I'll
- 00:57:11try to look into the worker nodes Health
- 00:57:13okay uh you can say that I wrote a
- 00:57:16simple uh python application where it
- 00:57:18will always monitor the worker node's
- 00:57:20health and in case the CPU or Ram is
- 00:57:22going out of limit okay for some reason
- 00:57:24the CPU or the ram is full it will send
- 00:57:27me uh alerts when the CPU reached 80 or
- 00:57:30when the ram reached 80 percent so that
- 00:57:32we take immediate action or you can say
- 00:57:34we
- 00:57:35implemented Auto scaling on the ec2
- 00:57:37instances
- 00:57:38but the best way is the approach that we
- 00:57:41learned today you can say that okay in
- 00:57:43our case we are actually using Docker
- 00:57:44agents and we only spin up containers
- 00:57:47when uh there is a Jenkins job that is
- 00:57:49running so in that case in that way we
- 00:57:51ensure that you know always our agents
- 00:57:54or uh the Jenkins is never down Okay it
- 00:57:57can always accept the traffic then comes
- 00:57:59your Jenkins administrative related
- 00:58:01questions where people will usually ask
- 00:58:03you like you know how do you install
- 00:58:05Jenkins or how do you expose the Jenkins
- 00:58:07port to external world all of the
- 00:58:09questions related to these things
- 00:58:12so if you want to learn more questions
- 00:58:14about Jenkins okay what are the
- 00:58:16interview questions that uh people can
- 00:58:18ask you on Jenkins and specifically cicd
- 00:58:20I'll put the links in the description as
- 00:58:22well so that you can watch those videos
- 00:58:24so I'll have two links for you one is
- 00:58:26how to set up Argo CD with this existing
- 00:58:29pipeline so the pipeline will work
- 00:58:30exactly as is like you know it will
- 00:58:33check out the code from Once you run the
- 00:58:34Jenkins pipeline uh it will check out
- 00:58:36the code it will build the code and it
- 00:58:38will update the kubernetes Manifest back
- 00:58:40into the GitHub and only thing that you
- 00:58:42need to do is watch this video that I'm
- 00:58:45showing you here and configure Argo CD
- 00:58:47on your mini Cube cluster or any cluster
- 00:58:50so that your entire setup is done if you
- 00:58:52have multiple kubernetes clusters you
- 00:58:54can configure Argo CD to deploy to
- 00:58:56multiple as well
- 00:58:58so finally
- 00:59:00um like I told you if you want to follow
- 00:59:01the entire documentation or if you want
- 00:59:03to follow the entire video in the future
- 00:59:05just clone this repository or Fork this
- 00:59:07repository so that you will have them
- 00:59:09handy I hope you enjoy the video if you
- 00:59:12like the video click on the like button
- 00:59:14if you have any comments or feedback for
- 00:59:15me do put that in the comment section
- 00:59:17and finally don't forget to subscribe to
- 00:59:20my channel
- 00:59:21thank you so much I'll see in the next
- 00:59:23video
- Jenkins
- Docker
- Kubernetes
- CI/CD
- DevOps
- Pipeline
- AWS
- EC2
- Conteneurs
- Déploiement continu