JENKINS END TO END CICD Implementation with Detailed Notes | BEST CICD PROJECT

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is Abhishek and welcome back to my channel so first of all I'm very sorry that I couldn't make the video on Sunday due to some personal commitments but uh no worries I'm back here with the same video ultimate uh cicd pipeline implementation I know many people are eagerly waiting for this because as promised I am going to teach you today installation configuration implementation of each and every tool that you see here except for image updater we would be replacing image updater with shell script uh there is a reason for it when I posted uh the part one many people were asking me uh can we do it instead of image updater uh using shell scripts or Python scripts I understand the reason why many people have been asking that because image updater is not widely used and people want to you know during the interviews they want to communicate uh uh you know using the tools that are widely used and people also asked about ansible but uh trust me ansible is not a very good tool to be used uh in this CI CD pipeline ecosystem for application deployment if you are dealing with some configuration management then that's fine but uh you should always go with the git Ops approach for a CD pad so that's where we will use Argo CD so what we are going to cover today on a high level is we will uh build a Java application uh using Maven we will see the configuration of Maven installation everything and then we would move to the sonar Cube uh sonar cube is basically used for the scanning part image scanning part and uh we will try to set up the sonar server locally and what we will do is uh we will also send the report of our code execution static code analysis to sonar Cube then we will move towards building the docker image for this artifact we will push the docker image to Docker Hub and what we will do is using the Shell scripts we will directly update like you know um uh like I told you in the key tops approach you have to keep a manifest repo or you can also create a new folder inside this source code wrapper especially for the Manifest to include the capabilities of git so using the shell script instead of image updater I will automatically update this manifest repo or similarly source code a folder in the source code repo is also fine and then using Argo CD we will deploy this manifest automatically to the kubernetes cluster so we will see this end to end workflow with everything and I'll show you the report details uh so you can also Fork it clone it try it by yourself no modification is required except except for your credentials and the things of course so now uh let's firstly show I mean I'll firstly show you the repo I think uh people who are following my video already know this repo so uh Jenkins Zero to Hero uh there are already 221 people who have started and 539 people have forked this wrapper uh I will recommend you to start the repo more than folk because uh if you poke the repository and uh future there are any changes to this repository you will not even get notifications uh because you have just forged it if you start it or if you watch it uh that's the advantage where you get the notification of like it says that Abhishek has added a new change to the repository something like that okay so uh quickly uh this is the pipeline that we are going to implement I just explained and the interesting part is I have a readme uh document uh for the application as well I'll talk about the application in a while but even for the application I have a readme document which covers the again uh everything that we are going to talk today how to set up this application locally how to install Docker configure it and how to set up the sonar Cube server we'll follow the same steps uh throughout the video so you people can also open this in a different tab or you can watch the video later point of time when you implement it probably you can use it quickly to start with the application because that's the important part right many people have been asking about Java based application because we have dealt with python based application previously so uh yeah I with the very like you know very old or the past experience that I have on Java I've written a very simple uh spring boot application so it's it's nothing but a simple uh like you know I created a package called comma bishek and I put a MVC architecture based springboot application where you have a controller that just passes a few attributes uh to The View and in inside the view you basically uh have a index.html file which renders these fields and displays displays it to the user right so this is the application and uh like I'll show you the application first so that you get a feel of what we are trying to deploy what we are trying to use and probably then I will talk about each and every stage of this thing how to configure build and use also apart from that we will see how to write the Jenkins file because that's the interesting part uh for the devops engineers right watch the video very carefully throughout the end because I'm also going to cover a lot of interview questions uh because we are going to do this video entirely live entirely practical uh I'm I don't have even the instance configured by myself so each and everything that we do uh will be uh live uh installations and all so yeah if you have any questions probably uh when I'm doing it if I am going wrong somewhere I might also debug and people who are watching it can understand how to debug as well so firstly uh before I show you how to uh how this application actually looks like what I'll do is uh meanwhile I'll create an ec2 instance so that I can save some time right so I'll go to the AWS account and because this is a heavy application right uh or the number of tools on this are heavy so the instance uh the freeze free time instance would not work uh there is a reason for that because uh you know sonar server or Jenkins server and then you install Docker on top of it so all of the these things consume resources more than your free time instance so if you go to the ec2 dashboard and if you uh try to launch an instance on a free instance you will just get one CPU and one ram right that will not be enough for all of these installation uh typically it might go up to three to four GB Ram as well uh so that's why what I'll do is I'll create uh let me call it as ultimate uh CI CI CD demo uh but what's important is we will select a Ubuntu and the instance type this is important uh what I'll do is I'll use a T2 large because I get two CPU and 8 GB memory which is good enough and as soon as I'm done with the video I'll delete the instance so probably it would charge me uh uh 20 15 to 20 rupees INR it shouldn't charge more than that uh for okay I might do a 1 hour demo so probably it might charge me around half a dollar not more than that if I delete the instance at the right time now uh key value pair I already have it I'm not spending more time here because many people already know all of these things uh if you don't know you can watch my previous videos so I'll click on the launch instance and now I'll go back and I'll show you what the application is so if you feel that I am going little fast uh there are a lot of things in the video that I'll cover today so you can play the video at uh less speed or the other thing that you can do is probably you can watch the video one more time where you are not getting something or refer to the documentation but I'll try to keep my Pace as good as possible okay so firstly uh what I what you need to do is to run this application locally you can clone this repository I already have a copy of this repository so let me go there uh I'll just switch to my path where I have this so I usually keep all of my repositories in a specific folder I usually deal with go based application so I have it in the go path never mind so uh this is my application so I'll just go to this spring boot app right so what I need to do right now is firstly open this readme.md which will state everything that is required to run the application if you feel that uh in the same page it is I mean in the same terminal if it is not convenient you can also go here open the readme file uh inside the spring boot application and you have the steps to execute this application right so first of all clone this repository which is done I switch to the folder again it is done you need to install Maven uh so depending upon what uh laptop that you're using this is not part of cicd this is just to show you what application we are dealing with right so don't worry about it you can figure out how to install Maven uh if you're on Mac you can just do Brew install mac sorry Brew install Maven but even if you don't do this there is no problem because this is the demo where I'm going to show you how the application looks like this has nothing to do with cicd so ambient clean package I am just installing the application on my personal laptop and then what I would do is instead of running this jar file I'll run it as part of a Docker image so you can also follow these steps and you can also run this uh locally and I am repeating it one more time nothing to do with cicd just for you people to understand what is the Java application that we are dealing with so I have exposed it on localhost 80. right localhost 8010 so this is a very simple application uh it says ultimate cicd pipeline using Java I have successfully built a spring boot application using Maven this application is deployed onto kubernetes using Argo CD right so this is the application and using CI CD now we have to deploy this application on kubernetes so that's our end goal but saying that we will do this by following the good steps or you know by following each and every step of cicd Maven sonar Cube Docker image build Docker image push shell script to update the image manifest Argo CD that will pick up and deploy onto the kubernetes cluster okay so because you have to do with a lot of things let's quickly jump onto the video now let's see if our ec2 instance is ready because ec2 instance is the crucial crucial part for everything right so we will go step by step today and the first step that we need to do is the source code is already available right uh I have also shown you the source code I have seen I have shown you how does this application look like if it is deployed so let's move to the Jenkins pattern so if anyone has any doubts on how to install Jenkins or anything like in the same repository you have uh on the root of the repository you have uh each and every step on how to create this ec2 instance how to install Jenkins on top of it so even I'll follow the same steps so firstly get the instance URL to get the instance URL click on the instance ID copy this right so SSH onto that I have my pen file uh already if you don't have the pem file you should be downloading it when you create the ec2 instance if you don't then it is really difficult to get the ec2 instance back access to the instance okay now I am logging into the ec2 instance so this is my ec2 instance now let me follow the steps in the same way that is written in the document so firstly it is asking me to install open jdk that is open jdk 11 so let's do that Java is a prerequisite for Jenkins because Jenkins is a Java application right so this will get installed for the very first time when you are updating the app repost or any package manager reports it will take a little time meanwhile let's see what is the next command the next command is to verify if Java is installed or not uh and then we will proceed with the installation of Jenkins I'm very sure Java will be installed so I'm ignoring this step and let me copy this so that I'll install Jenkins as soon as this is ready okay 60 90 100 perfect so 99 yep so now Java is installed so let me proceed with installing the Jenkins so Jenkins you can as it as it is copy paste the command right to install the Jenkins uh when once this is done the Jenkins server will be started by default on port 8080 right so we I just showed you uh the application was running locally on my laptop on 8010 right similarly when you run Jenkins the default Port that is configured for Jenkins is 8080. so now as soon as okay sorry I need to press y because uh the package manager expects you to agree for the installations so unpacking the Jenkins is going on and as soon as the Jenkins uh let's say is installed if you try to access the port localhost 8080 you will notice that Jenkins will not be started and many people already know the reason why that is because the inbound traffic rules are not configured on the ec2 instance so meanwhile let me configure the inbound traffic rules what is inbound traffic rules basically inbound traffic rules are security rules which like you should come here and modify it basically there are security rules which prevent the Ingress traffic that means to say the incoming traffic unless you open the port for the ec2 instance so you can simply edit the important traffic rules even if you delete this one right SSH then nobody can even SSH onto your instance so for the purpose of demo because I know that in the future and the same ec2 instance I am going to start the sonar server I'm going to um you know launch Argo CD on a different instance but I'm going to make few installations so every time I don't want to come here and edit the inbound traffic rules so I'll just open all the traffic to the instance coming from anywhere uh any ipv4 IP address and just save the rules but uh again I'm telling you because this is a demo we have that uh Liberty of doing it or we have that extra space of doing it but on your real-time environment do not open all traffic restrict it to whatever you require okay now Jenkins is running also how does it how to check if Jenkins is running just say PF minus es sorry PF PS minus EF grep Jenkins so you'll see that the Jenkins war is running it's a web archive file Java web archive file and it is running on port 8080 now let us see uh because we have also opened the inbound traffic rules if Jenkins is running or not awesome Jenkins is running right and this is my uh Jenkins server that is running uh looks like there is some configuration that is already there on this specific instance how is it possible oh sorry my bad I shouldn't be doing localhost uh so it is showing up uh Jenkins instance from my laptop uh yeah what was the mistake that I made the mistake is that you should use the IP address of the ec2 instance not localhost because we have installed Jenkins on this IP address right uh my bad so I was wondering how there was a job because the instance was just created yeah so now uh we have configured the inbound traffic rules as well so I'm expecting Jenkins to run perfect so Jenkins is running now and uh your very first step is to copy this initial password if you don't copy this initial password and uh let's say you have restarted the Jenkins or you need this password in the future again you have to go to this file location and you have to get it and because this is a demo I will not bother about creating admin user or creating more users because the scope of this Jenkins instance is just for the purpose of demo after the demo is done I am going to delete this instance so I'll just save this key that's it okay I'll just open a tab and I'll just keep it here okay uh just for the purpose of reference whenever I need it in case I'll have to restart Jenkins for sure so whenever I'll restart the Jenkins I'll use it I'll show you why to restart Jenkins so I'm installing the default plugins uh no changes and Skip and continue as admin user I don't want to create any further users save and finish so my Jenkins instance is installed now I am ready to use the Jenkins the next thing that I have to do okay let's go back to the diagram what is the next thing that you have to do so in Jenkins the first thing that you have to do is to write a pipeline right so to write a pipeline what you need to do is okay I I'll show you through the Jenkins UI itself so to write a pipeline basically you will go to the Jenkins click on new item and inside this you have multiple options create a freestyle project pipeline project what is the significance of each of each and every project here so freestyle project uh is a legacy uh way of configuring uh Jenkins Legacy means uh the traditional way of configuring but the good way of doing it is using the Jenkins pipeline because if you're doing the Jenkins pipeline way what you will do is you will write the pipeline in a groovy scripting okay and this and this Jenkins file uh in which you write The Groovy code can be stored in a git repository and you can collaborate with others right whereas if you do this if someone is making the changes you will not be aware of it so declaratively if you want to configure your Jenkins files if you want to collaborate as a team so pipelines is a way of doing things now click on the pipeline click ok and where do you write the code so we have been talking about Jenkins pipeline right so we say that we write Jenkins code in groovy but where do we actually write it so Jenkins says that you can write it in two different ways one is you can write it here okay you can just start writing The Groovy script here or Jenkins also allows you to put your Jenkins file in the repository where your source code is so I'll prefer this way because I don't want to keep it uh in two different places right so developers and devops Engineers or everybody who knows this specific in your organization you might have 300 400 repositories right so for each and every repository that devops Engineers are dealing with for each and every micro service let's say you can keep your Jenkins file in the same place so this is my folder this is my application that I have shown you right it is in the folder called springboot app here I have configured the Jenkins file now what is this Jenkins file what is inside this Jenkins file what are the different stages inside this Jenkins file how to write this Jenkins file I'm going to explain you so right now do not uh go into it because we need to learn lot of more things before we actually learn it right so let me open this here uh the Jenkins file so the purpose of what I want to show you here is okay you can either write the code inside a Jenkins file you can create a file called Jenkins file at the root of your application right not at the root of your repository I'm not doing it to the root of my repository because inside your repository also you can have two to three applications right it depends upon your project configuration so for now this application repository sorry this repository has multiple applications python application Java application so inside my application at the root of my spring boot application I have created something called Jenkins file typically the place where you have the docker file as well okay so what I need to do now I have to tell Jenkins where is my Jenkins file so for doing that again go back to your uh Jenkins you have clicked on the create item pipeline script from sem and sem select as git so this can be for GitHub bitbucket stash gitlab anything like the git is a common thing here you have to provide your git URL right it can be a public it can be private it can be behind VPC uh VPN or anything and it can be any git uh distribution as well so now I'll come here and I'll copy the path okay what is my repository path this is not this is all not my report repository path so that's it right github.com I am viramala jenkins02 hero this is my repository now credentials I don't need because this is a public repository but if it is a private repository you would need credentials after that Master no my branch is main uh depending on your branch is it Master is it main use the same Branch okay if you have a main branch and if you use Master it will not work if you have master and if you use main it will not work right now path to your Jenkins file so what is the path to my Jenkins file inside this repository what Jenkins will do is it will clone this repository and it will start searching for the Jenkins file so you have to tell it what is the path for your Jenkins file so this is an interview question as well in your interview interviewers will ask you can the Jenkins file be in any location the answer to it yes it can be in any location can the Jenkins file have a different name obviously it can have a different name if you see here f is capital there is a reason why I have put this as capital F ideally uh in the examples you will see it as small F but there is a reason why I put it as capital F inside here as well that is because to explain you and to show you all that the naming convention can be anything and it can be in any folder as well so you have learned two interview questions as well right now as soon as you apply it so when you start triggering this build okay so now Jenkins understands where is the Jenkins file okay right now don't go beyond it just understand till here because we are going step by step right so right now what you have understood is how to create a Jenkins file or what is the purpose of creating a Jenkins file that is basically inside the Jenkins you have created a Jenkins file that can be imported from sem or that can be also written inside a Jenkins job itself and the purpose of it is to execute all the other tasks of the continuous integration watch me telling this carefully all the other tasks of continuous integration only I am not talking about the continuous delivery okay so rest all the tasks that you see here Maven sonar Cube Docker image updated test you can ignore because test you can write your own you can write unit as you can write end-to-end test and there is no specific additional configuration that you have to do for the test you can just execute the maven Target itself and your test will also run so not bother about it so your Jenkins pipeline will have all of this code we will see it but before that let's proceed with the installations first okay because uh the Jenkins uh when once it starts executing it will need all of these setup right uh for sonar Cube it needs uh sonar server for Maven it needs a configuration related to Maven Docker it requires Docker to be present right so like I have told you in the previous class also one of the good ways uh let me open this is in raw one of the good ways of writing a Jenkins pipeline is to use Docker as agent okay that means to say use Docker containers as agent for your Jenkins pipeline there is a reason for it I have also explained very elaboratively in the Jenkins 020 class I am telling it one more time the purpose of using Docker agent is you can lessen the configuration and the additional benefit that you will get is this Docker container in which you are Jenkins job so all of these stages that is inside your Jenkins right there are multiple stages and this stages can keep increasing depending upon your complexity of your source code so if you run all of these things in a virtual machine let's say instead of Docker container what you have done is similar to the ec2 instance here you have created one more ec2 instance and you have configured that ec2 instance as a slave you have created one more ec2 instance for a different project so that way you will keep on adding easy to instances and the downside of it is one find a let's say there is no load nobody is making changes to the development code I mean the source code but this ec2 instance keeps running right you cannot even stop them or you can use uh Auto scaler but you know even if you're using Auto scaler or even if you're using all of these things uh you might say that Abhishek I can use the Jenkins order scaler but still you will have the minimum configuration right so the downside of it is you have to do a lot of configuration and still your virtual machines some of the virtual machines or many of the virtual machines are running and AWS will cost you for that if you if you are using AWS or any other cloud provider you are charged for those instances and okay this is one side of it and the other thing is you have to do a lot of configuration on each of these machines right so let's say you have a ec2 instance uh worker one worker two worker three you have to install Maven and all of these things or you have to install any other required dependencies on all of these things Docker or something else right so instead if you use a Docker container you can just write it once and whenever the container gets created the configuration will be created right and the container will be deleted right after the execution of this uh Jenkins file so the advantage is that as soon as your pipeline gets triggered so your pipeline takes the responsibility of creating a Docker container your pipeline will execute all of these stages inside the docker container and once your Docker container or the Jenkins pipeline is done once all of your stages are successful Docker container is deleted so it has a lot of room for the other jobs to execute parallely like many containers can run on an instance or because the containers are deleted so you your resources are freed up and there is enough resources for the other Jenkins jobs to run so I've explained this even elaborately in the Jenkins 0 To Hero class you can watch it there if you don't understand the significance of using a Docker as an agent for your Jenkins pipeline perfect so now once you decide to use the docker as an agent there are two things that you have to take care of first is you have to install the docker agent not Docker agent there is a plugin that I am going to show you firstly you have to install that plugin and the second thing is you have to choose your image wisely okay so most of the times it is responsibility for the devops engineers to write this image okay you need to write a Docker file in this case I have reduced your burden because I have this image and you can use this image even for your future purpose not just the purpose of the demo if you need Maven and Docker in a single image you can use this image whenever you want wherever you want um right uh so your responsibility is to write a Docker file and Jenkins responsibility is to trigger uh the docker container which has Maven and Docker in it okay so firstly like I told you because I'm using the docker agent the very first installation that I am going to do on this is install the Docker pipeline plugin okay so for that I'll come here uh dashboard Jenkins and what I would do is uh go to plugins and here search for Docker pipeline so this is the plugin that you need to have available plugins okay you need to search in the available plugins all the time in the old versions of Jenkins I think it is by default selected uh but here I think you need to select it nowhere is Docker pipeline install without restart and you can restart it later once all the plugins are installed okay so awesome this plugin is installed now what is the next thing that we will use is okay let's go back here where is the architecture right so I've installed the docker container which already has Maven so I don't have to bother about the installation of Maven right what is the next installation the next installation is sonar Cube okay so what does that mean I have to install the sonar server so there are two things again to install the sonar server firstly of course you have to go to your ec2 instance install the sonar server and the other thing is you also have to configure the sonar plugin here so let's configure the uh I mean first install the sonar plugin plugins available plugins sonar yeah this is the one sonar scanner install without restart right awesome so I've installed both the plugins now again let's go back to the architecture diagram what is the next step is to install the sonar server on my ec2 instance you can install it elsewhere as well you can install it on your laptop but only thing is your AWS should have connectivity to this sonar server because you are running Jenkins on the AWS so better create it in the same VPC if you don't want to get into the complexities of handling the network Ingress VPC VPC pairing if you don't want to get into all of these complexities then yeah put put it in the uh same VPC and mostly use the public IP address because this is a demo in your organization you can use the private IP addresses okay so so in our Cube how do I do that you might ask me this question so that's the reason why I've already documented it okay so anybody who gets confused let's say during this installation don't worry all of this is documented uh how do you do that go to the readme file of the application not the root here so uh if you go here I have documented clearly how to configure sonar locally that is on the ec2 instance or anywhere else firstly I'll create a sonar Cube user this configuration can be quite complicated in many places so don't worry about it just follow these steps and you will be installing sonar server in two minutes okay uh where is my ec2 instance this one right so firstly I'll add a user called sonar Cube uh go to the root user to add the user right uh sonar Cube user is added what is the difference between AD user and user ad this is an interview question that I am asking you people so whoever is watching the video till now uh if you know the answer reply uh in the comment section what is the difference between add user and user ad uh user sorry add user sonar Cube you can uh basically create Linux users using both the commands add user and user ad but what is the difference okay so provide uh the password Here anything that you would like to if you watch this video carefully you'll already know the answer okay so the user is added perfect now let me switch to that user uh what was the username sonar cube right perfect so I'm into the sonar Cube user what are the next steps provided here okay the next step is to use the wget to download the sonar binary so basically we are downloading the zip file this is the sonar recommended installation you can use latest version of sonar just to let you know uh I did not bother about the versions because this is just a demo but if you if you bother about uh okay what it says unzip is not available again go back to the root user because I want to install something and just say apt install unzip okay don't feel that I have missed this uh in the document uh people who are watching it you can also contribute to that repo if I'm missing something it is all of our repository right it is not just my repository all of you are using that repository so if you feel that uh some documentation is missing or if you feel that we can enhance this repository somewhere please please please do that contribution okay unzip star perfect so the sonar cube is I mean the sonar give folder is extracted now go to the sonarq folder and the next step that you would do is to Grant some permissions okay for that I think I need to go back that's why I should follow the steps as is right okay uh then go to the folder depending upon your architecture so if you if you are a Mac architect I mean so if you have arm architecture or if you are on Windows or if you are on uh OS X so choose uh where you want to uh in I mean what platform are you in so in my case I have uh I'm on an ec2 instance with Linux platform so now the final step is to just start the sonar server and by default sonar server will start on Port 9000 okay so it's at the sonar Cube server is started but it will take uh 30 seconds let's see what I need to do is click on new tab what was the IP address I can copy it from here and just change the port number nine thousand sorry see sonar cube is loading that means sonar cube is getting started and by default uh if you want to log into the sonar Cube that we just created admin admin is the password admin is a username admin is the password okay you can change it if you want to change it you can change it if you don't want to change it you can ignore it but for your organization you have to always change it okay so like I told you it will just take some 30 seconds let's wait uh all systems operational okay so that means my Sonar cube is running provide the username password admin admin it will immediately ask you for uh you know enter a new password I think there is no way to skip it anyways so you have to do it admin [Music] um perfect I've updated the default password okay so it has nothing to do with our CI CD but just you need to do it now the important part is okay if you go back to the architecture diagram for sonar Cube for Maven it is already installed as part of a Docker container right so the docker container already has a maven sonar I've installed the sonar and I've configured a plugin but how will Jenkins authenticate with sonar because there are two different applications right so for that what you need to do is go to sonar Cube click on my account okay then click on security here you will have an option provide any token name so because I want to use this token for Jenkins I'll say uh token as Jenkins and generate the token okay so this is a token click on copy button so that you copy the token okay and what you will need to do is go to Jenkins click on manage engines again and there is a place called manage credentials go to that manage credentials go to system Global credentials add credentials and you need to add the sonar Cube authentication here and we will use it later in the Jenkins pipeline okay we'll use it later in the Jenkins file you'll see that so copy this secret here provide the name let me call it sonar Cube okay no need of any description click on the create button it said some internal error record but it actually created it so no problem so now my Sonar Cube configuration is also done okay diagram here sonar cube is then Maven is done tests don't worry about it no no additional configuration related to test if you have external test yeah you need to do it like probably you need to integrate selenium or HP UFT or any other things but these Modern Day applications like if you're dealing with python or any other things you have some inbuilt modules to execute in end-to-end s as well or if you are using Robot Framework or something then you need to do additional configuration let's not go into the details of it for now let's assume these are Unit S only that can be executed directly so uh Docker the next thing is Docker right so for a Docker you need to install Docker locally on your laptop other things can be executed directly on the docker container itself okay the Jenkins Docker container that is created now here what I need to do is on my ec2 instance I have to install Docker right so let me do that again this is my eco instance uh go back to the root user so this is a root user if you don't know how to do the configuration so just follow my steps what I'll do is I'll copy the steps from my document itself the repository itself so this repository is very useful very handy uh like don't forget to start it not for my stars but just for your reference so to install a Docker see what it says is use this command okay and what would be the next thing is to Once Docker is installed add permissions to all of the users uh Jenkins or Ubuntu or whatever the user with Jenkins is running with uh it depends I the reason why I've added both the users is depends upon the people which user they want to use I don't want people to just come back and say that it's not working and waste their time so that's why okay just copy it Grant the permissions right so what I'm doing is Grant permission to Jenkins user Grant contribution to Ubuntu user to create containers run the containers pull the containers whatever it is and restart the docker not pull the containers create and run now restart docker Docker restart is done what you need to do is go back and restart your Jenkins now why you need to do this because whenever you are installing plugins whenever you are configuring something it is always a good practice to restart your Jenkins we have installed sonar plugin we have installed uh Docker pipeline plugin and we haven't restarted Jenkins right so that's why I'm restarting the Jenkins okay so Jenkins restart is very simple go just go to your url click on slash restart that's it it would restart Jenkins for you and here you will need the password so the password that I have asked to save you if you don't have the password here you need to enter the password right so that's why I just stored it here keep me signed in so that in future it will not ask me again if required perfect now my this step is also configured where is my architecture right so the docker step is also configured and what is the final shell script you don't have to do any installation this you don't have to do anything what is the final step is you need a kubernetes cluster and you need Argo CD so let's do that as well right so for that I don't need my ec2 instance I'll can install it on my laptop as well right because already on my ec2 instance there are a lot of things that are running so I can just take a new tab here what is this oh I forgot which one is it right yeah so this can be closed this is I think my one of my previous terminals I'll just close it yeah so uh this is a pipeline uh sorry this is the terminal where we are doing things and I've just taken a new terminal new tab that's it not a new terminal and what I'll do is I'll uh run mini Cube cluster on it so if you need to if you want to know how to run a mini Cube cluster it's very simple just go to the minicube page and you can Pro you can get the installation steps not a big deal at all so because I'm on Mac I would like to use hyperkit okay uh uh the command is just this one here like if you are on Mac definitely use this because the default driver for mac and windows would be the docker driver because we use the docker desktop right so the driver would be uh Docker driver and with the docker driver you might run into some network configuration issues so yeah whenever you are dealing with huge applications or whenever you are dealing with some demos like this always I would prefer to use hyperkit but if not I'm not a mini Cube guy I would always prefer something very lightweight like kind or k3d but when you're doing such installations or huge things then you would go with minicube okay so this will take a little time uh for the mini Cube uh to install the kubernetes cluster let's see for 30 seconds if it takes more time uh I'll go back and do the pipeline work but if it takes less time uh yeah we'll complete this installation and go back okay so it says that uh creating hyperkit with VM configuration memory configuration that I've provided and also the disk configuration okay so meanwhile while this gets installed where are we in the architecture we have covered all the tools installation and configuration except for Argo CD Argo CD I can only do it once the mini Cube cluster is up and this will be very interesting for many people because many people haven't used Argo CD right so I'm going to show you in five minutes not even five minutes yeah five minutes I think because the pods have to come up in five minutes you can configure Argo CD install Argo CD use the Argo CD UI and deploy the applications as well but deployment it will take take place automatically so yeah you don't have to worry about it right so uh this is done Jenkins is installed Maven is installed now the next thing uh that is only left on my plate is to show you how to write the Jenkins file right so if I just explain you this file and what I'll do next is I would just go ahead and Trigger the uh this one what is this uh the Jenkins and I'll install the mini Cube and my pipeline should execute seamlessly so if there are any errors we'll debug it right so debugging is very important because whenever you are writing the CI CD Pipelines don't expect the pipelines to succeed on the very first run because on the very first run it's very difficult for your pipelines to execute uh seamlessly there are many configurations that you do as part of CI CD there are a lot of variables that you import there are a lot of tools that you deal with sometimes the token might be expired sometimes you know there are some changes that you have to make and here I did not use the build with parameters as well because I don't want to make this demo very complicated for the people just starting with so I have put some values here hard coded so I should also modify them so it's a it will be a very good demo for you people because I'm going to do a lot of things live and yeah the mini Cube cluster is started awesome now whenever you want to install any kubernetes controller okay so I'm not just talking about Argo CD here where is this yeah I'm not just talking about Argo CD whenever you deal with any popular kubernetes controllers the first thing that you should do is the installation of these tools should be taking place using the kubernetes operators so in kubernetes there is a concept called operators which will manage the life cycle of your kubernetes controllers so in future if there are any upgrades to the controllers versions or you know uh seamless updates uh Telemetry related stuff so for that things you should always use the operators and operators makes your installation process also very easy and they come up with some default configuration as well out of the box so that's why for Argo CD I would prefer the installation of Argo CD using the operator and people who are watching it definitely you will uh you know you will benefit out of this uh because many people might not know how to install kubernetes controllers using operators so there is something called as operator hub okay just go here and see how simple the kubernetes controllers will be installed okay so here you have bunch of popular operators uh and what our focus of interest is Argo CD right so just search for Argo Theory so this is the Argos video operator click on install it will give you a few few steps the first step is you need to have something called as olm which is operator life cycle manager let's not go into the details of it I can tell you in some other video but right now I'm just installing the olm I'll not do anything I'll just follow the steps here and my operator will be installed you will see the magic not just the operator my Argo CD will also be installed so it does a lot of custom resource definitions installation for you and a bunch of other things so you need to wait uh patiently for each and every step to be executed do not rush because you know it waits for the specific deployments to come up and start so hardly it might take two minutes so don't rush up and move to the next stage you'll land into some unexpected errors okay so the olm is getting installed after that I would install the Argo CD operator and this is just to verify if the operator is running or not and then I'll show you how to log into the Argo CD UI so that you people can visualize everything that is happening okay so it says that the uh specific deployments related to this olm are successful I think it should barely take uh 20 more seconds yeah it's in the face of installing package server phase let me copy this command meanwhile right yeah I think how how are you feeling this uh video till now right uh are you feeling this is beneficial and when we execute the pipeline I'm very sure you people will find it even more useful because many people can use this repository as is you people can you know take the inspiration from this Jenkins file because it has most of the things that interviewers usually ask you you can take this as inspiration you can modify it you can use this repo and you know you can also showcase it on your project uh whatever we have done till now you can also showcase it in your project and yeah it will be a very interesting uh add-on for your resume perfect so this step is done so let's proceed with the next step here what it says is Cube CTL create minus f just do it and here it might take a little time okay so uh this is basically installing the Argo CD operator this step is common for all the other operators and you just need to do it once on your instance okay once you are done with it the next step would be whatever operator you are trying to install only this step has to be installed that's it okay the olm installation is just one time installation it is operator life cycle manager now this is also done but wait patiently and what you need to do is you need to see if the installation is successful or not so basically you need to do Cube CTL get odds minus an operator's namespace so yeah don't get into the details of this if you don't want to understand this right now it is fine right now if you just want to deal with the installation of Argo CD Operator just understand you need to uh I mean installation of Argo CD just understand you need to install these three commands later point of time probably I can explain you what is operators uh how do they work why you need operators in kubernetes and all of the other things okay so let's give it some sweet time and go back to the Jenkins pipeline I'll talk about the Argo cd part later because it is taking a little time right okay so our Jenkins pipeline so what is this uh stages in Jenkins Pipeline and what are the different stages here so stages in Jenkins pipeline are nothing but what are the different blocks that you are trying to build using this Jenkins pipeline so here what I am trying to build uh I'm trying to build the application this is a this is one block I'm trying to run the static code analysis different block build the image artifactory push the image artifactory different blocks shell script which updates the Manifest repo another block Argo CD which is basically the continuous delivery this should be another block but this is out of the CI part right so like I told you CI and CD are two separate pieces and I don't want to do Jenkins CI using Jenkins I want to use continuous delivery model through github's model right so that's why I've separated the CI and CD I'll talk very detailed about key tops in the future uh where you will understand but right now even if you watch this video probably you should understand what is githubs and how it is beneficial okay so uh yeah this this process is going on we'll give it its own time uh meanwhile so now Jenkins fine so the first stage is checkout in our case the checkout stage is not needed that's why I just said uh Echo passed because anyways Jenkins is using the checkout uh Jenkins is doing the checkout right uh because our Jenkins file is also stored in the same uh source code repository so Jenkins anyways will check out so that's fine I'm not dealing with this checkout and also if you are using web hooks you don't need the checkout stage because oh sorry you need the checkout stage for webbooks uh my bad but if you are Jenkins file is already in the source code repository Jenkins to get this Jenkins file and run the pipelines it will anyways the Clone the it will anyways clone the repository so you don't need this stage let's say you will say that Abhishek I don't want to write the Jenkins file in SCM I want to write the Jenkins file uh in the Jenkins itself like you have shown previously uh in the Jenkins UI so in such case you have to definitely add the checkout stage okay because Jenkins will not understand where is your source code if not perfect so uh here just uncomment if you have the checkout stage if you need the checkout this uncomment this one and comment this one next stage is build and test so like I told you Maven is already available uh in the docker image so all that I need to do is just one mbn clean package one more interview question is what is the difference between MB and clean package and mbn clean install so we are covering a lot of interview questions as well right add user versus user ad yeah I will tell that answer as well at the end of the video don't worry and mbn clean package versus ambient clean install is basically uh if you want to push your Enterprise archive Java Archive of web archive to the ik factory or Nexus or any other places in such cases you can use ambient clean install but in my case I don't want to push artifact anywhere I just want to use it in the docker image and I want to publish the docker image to image artifact uh image repository so that's why I can just do ambient clean package and what mbn clean package will do this is very important and what I've done here is ignore this one I just said LS minus LTR you can delete this one as well so I said sh in in this stage CD to this specific uh because this repository has multiple applications I just asked to change directory to the spring boot application and I asked to execute this Maven Target now what will this do is so this is the spring boot application right it will go to this specific folder right and inside this specific folder it will try to execute the mbn clean Target so mvn clean install or ambient clean package will find this pawn.xml file now who is responsible for writing respond.xmls so it is partial responsibility in some organizations devops Engineers writes the pom.xml in some organization it is developers who write the pom.xml but mostly it is developers who write the form.xmls and devops internet should have a very good idea of palm.xml what pom.xml does is if you refer some 10 prom node xmls you will understand the entire architecture in a nutshell form.xml is responsible for getting the dependencies runtime and building the application I'll make it very simple let's say you are a developer you are writing a Java application on your personal laptop what is the things that you need okay you don't have to be a developer to understand this the thing is whenever you are writing any application locally inside your IDE or on your local you will download a lot of dependencies right let's say your application requires a jar file what you will do you will download the jar file and you will put it in the path or you will put it in the dependency where your application can read it okay or you'll need a multiple third party dependencies again you will download them and you will put it but as a developer you have done it you have pushed only the source code the dependencies nobody will push to the git repository right because dependencies are huge now when someone else used your repository okay it can be python it can be Java in Python we use requirements.txt file right and pip will take care of getting or downloading the dependencies similarly in Java we write a palm.xml file so the developer writes a com.xml file and he says that when I try to run the application locally I used all of these dependencies okay now whenever someone else runs it either in the Ci or in their personal laptops or through them any other XYZ ways you can use this form.xml and instead of downloading them locally I'll put everything in the pom.xml and there is a tool called Maven when you just do mbn clean install or ambient clean package it will download each and every package from the internet depending upon the versions and depending upon the things that I have provided here okay it will try to download each and every package and it will help Java in building the application what is building building is basically creating Enterprise archive uh Java web archive I mean Java archive or web archive or Enterprise archive right these are all jar or ER files now how are these Java error files created that is basically using Maven and pom.xml so that is the thing that I have written here mbn clean package and CD to the repository where the pom.xml is present so this is what you need to do okay so in case uh you are experienced with com.xmls okay what you will do is you will help the developers in writing newcomb.xmls but if you are a fresher devops engineer or if you don't have much experience in devops you just join the devops team then in such cases your developers will write the form.xmls and what you need to do is you need to explain in the Jenkins pipeline how how to execute where is this form.xml what is the maven targets that you want to use should use me and clean package should we use mbn clean install should we use any other packages oh sorry Maven targets perfect so this part is done now with this part your artifact would be generated what would be the next part is the static code analysis and when your artifact gets generated you will notice that okay uh because I have locally also run this application right so if you go again to that application folder I just want to show you people this uh Jenkins 0 to 0 right then it is in the folder called Java spring boot app so you will notice here that there is a new folder called Target that is created and inside this target folder the artifact is saved okay whatever the artifact that you have created if you do LS Target so this is The RK file that got created and this RK file itself I have copied to the docker Hub as well for example if you look at the docker file what I've written I have not written any rocket science I just said copy the jar file that is created previously and just execute the jar file that's it okay so this is the simple steps that I have mentioned you can get this from the GitHub repository as well so the docker file just copies this webarchy file and execute the web archive file that's it okay and this web archive file will run on the port called 8080 okay so my one step is done what is the next step static code analysis so as part of static code analysis what you need to do is first tell the Jenkins what is the URL of your sonar Cube because without the URL Jenkins will not be able to send the report uh or Champions will not be able to send the information to sonar server so you have created the sonar server you have configured the sonar server you just configured the password that's it right so what I'll do is I'll just use the password here okay and I will execute a Target all that matters end of the day is just go to the folder where your application is the reason why I have to change directory multiple times is in this repository I have a lot of things so that's why I have segregated on different folders but usually in your organization you will just see this target you don't have to change the directory but okay it's a good practice you people will also understand about this and what I will do is MVR sonar sonar so this is another Maven Target so this is a maven Target to build the application and this is the main event Target to execute sonar okay the analysis the static code analysis so for that it will need one input that is what is the sonar authentication token and what is the sonar URL so once this is provided again the requirement will be done so now whenever I am showing you the demo what I need to do is I need to modify this thing I need to modify the URL where the sonar is configured the ec2 instance URL that's it and then all of you know about the docker file right so uh the docker build steps Docker push step I don't have to explain about these things because I will consider you have experience with Docker if you don't have you can watch my Docker Zero to Hero video where I've explained because I cannot explain Docker things in this video it will become too long but all that you need to understand is I'm just passing my Docker credentials okay uh why we need to pass the docker credentials is because you will push this image onto Docker Hub and you know once you push it to Docker Hub uh or you know once you push it to uh your Jenkins uh the Manifest repo only then you know your Argo CD or any other continuous delivery tool can deploy it so these are the steps to uh you know build the docker image just go through the steps you will able to easily understand it the steps to build the docker image and the steps to push the docker image finally this is the important stage where you can use either Argo image updater or you can use the shell script in this case I have used the shell script and I have updated the repository so in my case I use the same Repository okay so if you see the repository URL Jenkins 0 to 0 I've used the same repository but you can create another repository as well in my case I already have 150 repositories in my GitHub and the repositories keeps on increasing I don't want to like you know I perform this demo it will create one more repository uh I mean I have to create one more repository and I have to delete it so like you know I don't want to the maintenance is getting too much for me on the GitHub so that's why I thought I don't want to create a repository I'll put it in the different folder okay uh the folder name here is the one that you see it's called springboot app manifests okay so this is the repository spring boot app manifest where I just have a deployment or DML file okay so this is the deployment.aml file and what I will do using the cell script is I'll just replace this replace image tag with the Excel image tag that is built through the CI CD pipeline okay I'll show you live and once this is updated uh we will use the Argo CD to pull this deployment manifest automatically and deploy it onto the kubernetes cluster okay so this is a very simple shell script where uh I need GitHub credentials okay I just need the GitHub credentials to push it back to the GitHub okay because I cannot directly push it to GitHub right if I don't have the GitHub credentials so these are the steps I just use the ACD command and push the code back to the GitHub so now what are the two things that are missing one is you need to put the docker credentials and one is you need to put the GitHub credentials uh inside the Jenkins okay so I'll do it uh what I need to do is again I have to go back to Jenkins just like we configured the sonar credentials manage Jenkins go to the credentials tab manage credentials uh click on the system click on global credentials add user first let's add the docker Hub credentials right uh Docker Hub credentials are basically a username and password so for that I can select where is it yeah username and password is out of the box what was the name that we provided here uh you know basically I'm reading the credentials here so this is the name uh using which I'm reading it in the Jenkins file from the Jenkins credentials store right so you need to put the same name I call it Docker cred so put the same name uh ID as Docker grid username what is your Docker Hub username in my case it's Abhishek F9 and the password put your Docker Hub credentials password create okay so the docker credentials are created now the next thing that you need to do is use the GitHub credentials for that uh choose secret text because GitHub has moved from username password to access token and access keys right so basically instead of username password you should put the GitHub secret here so let's call the ID as GitHub and how do you get this access key go to your GitHub okay this is my GitHub and go to the settings page perfect this is a settings page and here if you scroll down you see something called developer settings and then you will see something called personal access tokens click on the tokens classic and create a new reposit uh sorry let me just delete the previous ones I don't need them yep generate a new token uh generate a new classic token uh yeah I just need to do this so provide the name of the token let me again call it Jenkins I'll delete it as soon as the demo is done right I think I need to stop sharing uh for a second because the token will be visible on the screen even though I deleted security is very important so always do not share it like if I just click on General token uh it will just show up so I'll just stopped sharing the screen for a second generate token uh copy the token I have copied it I moved to a different browser I mean a different tab now I can start sharing one more time yeah you have to be very careful with these things do not compromise on security anywhere right so now go here and what you need to do is paste the secret and click on create so I think most of the stages are done and I'm expecting the pipeline to pass even if the pipeline will fail it's a good learning for all of us we'll try to understand why is it failing okay so before I do this thing I always prefer to restart because I have done a lot of configurations right every time you do the configuration just restart uh you know whenever you install some plugins or whenever uh you like the credentials and all you don't need it but whenever you install some plugins always restart it so meanwhile what I'll do is I'll just go back to my uh this thing here this is my GitHub like I told you I need to change the url of my Sonar right so this is the URL of sonar let me just replace it with the sonar Cube installation you need to do it uh in future I'll update this repository to variabilize it uh there is in general something called uh build with parameters right so I can do that uh the build with parameters thing but right now yeah it is not updated uh okay yeah let me just ignore this one uh go back to the Repository github.com Jenkins yep so inside here uh go to the Java Maven sonar like even if you are cloning the repository it will be easy for you go to Spring boot application go to Jenkins file click on the edit option okay search for uh sonar perfect this is the URL that I want to replace click on Commit message the comment message is important because you are committing the changes um yeah now let me see if the Jenkins is restarted ah sorry uh very sorry I did not click on uh yes button for restart of Jenkins no problem uh meanwhile let me just get the uh password for it I hope Jenkins will restart in a second it says your browser will reload automatically when Jenkins is ready yep we are waiting for it and now we are also Waiting for the End to End uh cicd pipeline to run automatically yep ultimate demo so this is only the CI part our Argo cd part is still pending uh the I think buying off Argo CD uh this thing will also be running if I just do OC uh sorry Cube CTL get pods minus n operators yeah I think the rocd operator must be running by now perfect Argo CD's operator is already running so yeah we can proceed with the continuous delivery configuration how to uh yeah I'll show you about the Argo City part in a while uh now let's focus on this one run on Bill now I'm expecting all the stages to pass fingers crossed it might even fail on the first step I don't know okay what is it doing for the very first see it says no image found so it is downloading the image which image is it downloading it is downloading this image basically because Jenkins has to start creating a container and execute all of these stages inside the container Okay so if you notice here this is my repository right and this is my application manifest you can put this application manifest in a different repository as well like I told you and what is the image name here ultimate CI CD replace image tag so my cicd pipeline The Continuous integration pipeline should build everything uh should create uh sonar report should push the docker Hub image we'll see each and everything and finally it also has to update this image with the build number let's see that as well uh what is the status looks like it has succeeded on the checkout build and tested using Maven static code analysis also successful now it is moving with build and push Docker image if this is also successful it will move to the first last stage that is Ultimate uh sorry uh shell script to update the manifest folder right so yeah this is tricky uh sometimes oh awesome amazing right it failed on the very first thing itself but yeah uh this is with practice so you might take 50 attempts uh yeah do not just compare uh do not just think that for Abhishek it just passed on the very first step yeah it's not same for all uh I do it day in day out uh I work with Jenkins for a lot of time I I have dealt with all of these uh components for a lot of time right so don't worry about this thing even if it is not succeeding initially it will succeed eventually right now let me just refresh here I'll show you step by step what each and everything this pipeline has done okay so if you see here the image is also updated but let's start from step by step what is the first stage you and Maven has to be uh yeah the container is created I've already showed you checkout obviously it is done Maven it has created uh the jar file I can show you that if you go to your Jenkins here for okay if you go to the Jenkins logs you will notice that click on the full log you'll notice at the maven Target okay so this is the main event Target here what it is doing is it is downloading a lot of packages okay so mvn claim package uh it switch directory and it is running the mbn clean package I mean it ran the mbn clean package where it is downloading all the dependencies it downloads all the dependencies and it says that you know it has created this jar file it is building this jar file and finally it says the jar file is built without the jar file being built your next stages will not be successful because you are basically relying on this jar file right now what is the next Target once this jar file is built like it downloads all of these things like whatever you are seeing so it all of these things will be present in application uh developers local laptop so we have automated this using the CI see how many things have you automated all of this is still about your mbn package itself or the ambient clean package scroll down uh yeah so that is then now next thing is about the sonar part okay so what does the sonar part does uh sonar part basically executes this command called me and sonar sonar and it basically pushes the report to this sonar Cube let us see if it has pushed or not this is my Sonar server let me just refresh it okay go back to the project you will notice here that see spring boot demo and it says the sonar configuration has passed why has it passed because there are zero bugs zero vulnerabilities I just wrote the application right and uh you know with very little knowledge that I have uh on the spring boot uh yeah not very little knowledge uh like very old knowledge uh to be precise because I haven't used uh for a while and all of the steps are passing like you can play around with sonar what you can do is you can just remove some comments or you know you can try to add some duplicate code inside the Java application that I've written and sonar will show you some uh you know code smells uh it says that okay there are some line duplications you can remove the line duplications or sonar says that you know if you start adding the unit tests or more test sonar says that the coverage has increased so all of these things uh sonar can take place so you can play around with sonar uh this is the important part this is a critical part which I have already uh shown you here rest things you can play around and then uh architecture what is the next thing a Docker image should be created right let us let me go and see if the docker image is created on my personal space or not where did I configure that if you go here I have clearly mentioned that Docker image has to be you know uh with this name Abhishek fi ultimate CI CD and the build number build number is one so in my Docker Hub I should see this image not only in my Docker Hub you should also see it here if you just say Docker images even on the laptop or on the server where Jenkins is running a new image will be created uh this is the easy to instance right so if I just say Docker images see Abhishek F5 ultimate CI CD build tag one so even on your ec2 instance this image will be created and even here if I just say Abhishek F5 ultimate CI CD right so you will notice that the latest tag that is created is with the one okay so it says that Abhishek F5 ultimate cicd one tag is pushed and final step is using the shell script I've also updated this previously it was replace image tank and this is also done so we have successfully executed the CI part Jenkins is done hit is done Maven is done sonar cube is done Docker images is done shell script updated the repo all of this is done so last one hour I showed you all of these things now the final steps is use the Argo CD to deploy automatically onto the kubernetes so we'll see these steps as well this is my uh where is this yeah so my kubernetes cluster is on my personal laptop right so let me see the status of mini Cube mini Cube status uh it is running uh perfect now I showed you that Argo CD installation is very easy I've installed the Argo CD the very first thing that I have to do I've installed the Argo CD operator so first thing that you need to do is go back to the documentation itself okay this is the Argo CD operator documentation click on operator documentation uh the one that I'm showing you go to install getting started uh yeah sorry usage Basics just copy this example as is okay just put it here anywhere you can put it let me call this as Argo CD what I'm doing right now is I am trying to create the Argo CD controller till now we created the Argos video operator now as soon as I submit this Cube CTL if you don't want to get into all of these complexities you can also install using Helm chats but this is very very important and this is very very useful as well for you people so try to follow this okay now if I do Cube CTL get pods in future everything will be kubernetes operators in future everything will be kubernetes controller so it is very essential for you people to learn this Cube CTL get pods you will notice that the Argo CD workloads are getting created and that's it you don't have to do any additional configuration related to operators and controllers now all that you need to do is just go to the argosity UI and I'll show you how to pull uh the latest image from the git repository here this one right so this is my git repository and I'll show you how to get this uh deployment from the git repository onto the kubernetes cluster using the CD process so just let's wait for these things to come up so the containers are creating uh meanwhile uh I want to run this also on my uh this thing right on my browser right so for that what you need to do Cube CDL get SVC so these are the services this server is responsible for the Argo CD UI so you can follow the steps as is what you will do is Cube CTL edit SVC because I want to run it on my browser so I'll just change the type from node port to sorry cluster IP to node portal okay I've changed from cluster IP to note Port now this configuration is edited okay so what I will do now is if I just do Cube CTL get SPCA you'll notice that this is changed to the note Port mode and now to execute it on browser minicube offers you a very good thing that is mini Cube server this is the name of the service right so this is the name of the service and this is a mini Cube service if you execute this command so minicube will generate a URL for you using which you can access it on your browser as well for example now I can just say minicube service list and this is the URL that minicube says that okay I have done some code forwarding now you can access this URL for your Argo CD server through the browser but before that my Argo CD Port should be up and running Cube CTL get pods are they still up or Not Perfect all of the pods are up and running now just copy this and put it on your browser so you will notice that Argo CD just click on Advanced accept Argo CD is running right so the rocd configuration is also done all that you need to do now is provide the username provide the password how do you get that username password so username is just admin and password what you can do is Cube CTL get secret Argo CD stores the password in a secret called Argo CD cluster okay Cube CTL edit secret Argo CD cluster secret so because this is a recorded video you can watch this Steps step by step you can pause the video I know I am going a little speed with respect to Argo CD because I am very used to it and I use it every day so I am going at a little speed unintentionally but you know I apologize for that and what you can do is you can play this part of the video very slow and you can watch the steps okay so now I copied the secret what I need to do is kubernetes secrets are base64 uh encrypted right they're not in plain text so just do this Echo base 64 minus D so this will be your password just copy the password not the not the symbol okay if you don't want if you if you want to get rid of that symbol uh you can just say Eco minus n here uh okay never mind so just copy it ignore the last symbol and paste it here so you have logged into the Argo CD in two minutes your application will be deployed stay with me provide the name of the application as test default sync as automatic provide the URL okay this is the URL let's say I'll just modify it okay now you just have to tell Argo CD what is the path of the deployment file so this is a path of the deployment file this is my folder this is my application manifest folder and this is my deployment.yaml and finally provide the cluster just provide the same cluster name because you want to deploy it on the same kubernetes cluster click on Create and you will notice that the uh what does it say unable to foreign okay oh okay sorry I don't have to mention this deployment.yaml my bad just click on the create button you will notice that the application will be automatically created on your kubernetes cluster so Argo CD is trying to fetch that information and wait for a minute Argo CD will deploy it what is it doing uh it says two errors what are the two errors uh ddim is the namespace when I am when I was trying to configure uh let me see that edit what did oh sorry I miss the namespace provide the namespace as default yeah this is a problem if you go too fast uh you might miss a few things but it's fine now click on the sync button it is automatically getting synced anyways so sync is okay it says that the deployment is being created replica sets and the pods are being created because I have mentioned the Pod replicas has two so this is how Argo City pulls the information directly you don't have to take this deployment manifest you don't have to go to kubernetes you don't have to like you know if Argo city was not there you need ansible or you need any other tool or unit cube CTL you need to install Cube CTL on the Jenkins and you need to uh you know configure uh the kubernetes secrets or any other things right uh Cube config related information and you have to in the Jenkins file you have to say that Cube CTL apply minus F this uh file but instead if you are using Argo CD the advantage is that you know not just Argo CD deploys it so if you see here why is it taking a little time Cube CTL yeah get deploy perfect Argo CD has deployed our spring boot application pods might not be running because of our mistake oh pods are also running awesome so these are the spring boot application ports that are running perfect so Argo CD has taken care of this deployment now I'll show you the beauty of Argo CD that is so it's it says everything is healthy right now what I'll try to do is let's say I'm uh a malicious user what I'll do is I'll just say Cube CTL edit deploy spring boot app okay and I'll try to just play around with it and as a malicious user I'll just try to update the image URL for example instead of one I'll just try to change it to 2. and it should fail because 2 is not at all available I haven't pushed anything related to 2 and I'll save it okay what you'll notice is okay it got edited but if you click on this refresh you'll notice that just give it a second uh yeah because this is a local server local Mini Cube server right so it takes sometimes uh to load the applications because I've installed uh heavy applications on this already just give it a while but what I would like to show you is Argo CD will understand that A Change Is Made and it will auto correct okay it says that okay someone has updated the image and uh yeah I see that there is a difference so let me fix the difference okay so see there is one error in the app condition that Argo CD said okay this error is related to uh some context uh deadline that is because uh you know like I told you it is a mini Cube cluster and on the mini Cube cluster I'm running so many things so because of which it is basically uh saying that yeah it is basically throwing some errors uh don't worry about it because I have already shown you how to configure Argo CD and how to manage it maybe when we do a detailed uh git Ops related video you will understand but here this is one this is what I wanted to show it says that application is out of sync right what Argo CD says is uh just try to see the difference here it will clearly tell you that someone has modified uh the image on your cluster see this is the capability of argosity it says that someone has tweaked the image that there is a malicious user who said that who has updated the username uh the image name to two but actually it should be one so Argo CD says that don't worry I'll fix it as well I'll automatically heal it uh I need to add more configuration to it and also there is some context deadline uh but if not I can just do some Sync here Argo CD has notified me that uh there is some configuration drift and I can sync it and everything will be done but right now you are not able to see it because yeah Argo CD is little slow because I'm on my mini Cube cluster and uh I have other applications running on it perfect on the machine not on the mini Cube okay uh perfect so this is the demo and I think we have covered each and every part of it uh very uh detailed and you came to know how to execute the cicd pipelines how each and everything is configured how Argo CD is configured to deploy if you have any questions uh in this video you can refer to the documentation and finally if you have followed the video entirely I'll give you one good suggestion implement this project like you can take the same repository of mine and you can implement the project and what you will do is you can create this project very beautifully and post it on LinkedIn as well as GitHub okay so there are recruiters who will watch for these things uh paste this image entirely write the entire things very neatly beautifully explaining each and everything that you have done you can provide our channel for reference if you want you can also tag me and say that you know I've built this end-to-end pipeline uh it was a very good learning blah blah blah whatever you would like to write and yeah finally it will be very beneficial for you yeah I think I'm getting throat pain as well okay so uh finally if you like the video click on the like button if you have any feedback click on the comment section or write it and don't forget to subscribe to my channel because it takes a lot of time for me to make these videos and also a lot of effort so your subscription is the only motivation that I get and if possible share these videos with your friends colleagues and try to get more followers to our Channel more subscribers thank you so much I'll see you in the next video take care finally our Rel to end ultimate pipeline implementation is done see you all bye
Info
Channel: Abhishek.Veeramalla
Views: 344,149
Rating: undefined out of 5
Keywords: devops interview questions, devops mock interview, devops discussion, devops, devops round table, aws, azure, k8s, tanzu, vmware, openshift, redhat, gcp, openstack, aws complete devops project, devops proxy interviews, #bts, BTS, bts, Ansible, Ansible FAQ, Ansible Q&A, Devops interview questions with answers, terraform, terraform interview questions, terraform Q&A, git, github, azure git, bitbucket, stash, gitlab, azure devops interview questions, devops interview questions for experienced
Id: JGQI5pkK82w
Channel Id: undefined
Length: 87min 11sec (5231 seconds)
Published: Tue Apr 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.