What is GitOps | GitOps explained with ArgoCD project

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you are a devops engineer you might have heard about a very popular term gitops but what the is kops so in this video I will be explaining you what gitops is how we use it in real world applications what are benefits of using gitops and also a Hands-On project where we deploy a simple application on kubernetes using a very popular gitops tool Argo CD this is going to be the only video you need to understand giops from scratch so watch this video till the end let's start hey everyone and Welcome to Cloud champ let's start with understanding what is gitops before we move ahead with different benefits and the Practical example of deploying an application using giops technology what is giops so giops as the name suggest combines of git and Ops which is a devops practice that uses git repositories as a single source of Truth as a devops engineer you might already be familiar with Git which is a Version Control tool that lets you store your code on different repositories like GitHub or gitlab or bid bucket so giops is a devops practice where you have git as a single source of Tru to deploy your applications to manage infrastructure or also to configure them let's try to understand this with real world examples and see how giops can be used with popular devops tools like kubernetes Anil or terraform to make this easier let's understand what happens when we don't use giops starting with kubernetes so in kubernetes we have to write down our manifest file to create different components like Services deployments boards nodes config map and ultimately deploy your application similarly in terraform you have to write down your scripts that will create resources in different Cloud providers and in anible we have to write down playbooks that can configure servers but after you create manifest files you have to manually run CBE C create or apply to have that component in your clust similarly in terraform you need to run terraform apply command to create resources in the cloud and in anible you need to run anible Playbook command to configure servers and run the Playbook on different servers and gitops automate exactly this process now deploying an application manually or creating infrastructure or configuring servers manually can cause a lot of issues like increase risk slower deployment time uh difficulty in roll back and lot more instead of doing this manually you can use giops tools like AR CD and CD which uses your git repository as single source of Truth so how this actually works is you will connect your git repository with giops tool and it will constantly check your repository if you have made any changes so let's say you changed the image in the deployment manifest you don't have to manually run Cube apply the giops tool will automatically detect any changes you made and synchronizes your application or infrastructure to match the desired state that you have defined in your git repository this is why definition says that gitops uses git as a a single source of Tru because anything that you have mentioned in your git repository will be shown in your application and if there is any issue it can roll back as well now let's look at different advantages you can get when using giops the first benefit of giops is obviously automation with get offs you can automate the deployment and management of infrastructure reducing the need of any manual intervention and minimizing human errors second benefit is Version Control with Git as a foundation in gitops you have full version control and you can easily track any changes or roll back if any issue arises next is consistency when you use gitops with your different environments like staging production and development all of them will have same configuration settings that you have defined in your git repositories which will avoid any configuration issues that might occur if you do it manually another benefit of using giops could be security so you can control access to your get repositories providing robust security and only allowing authorized users to make changes to your app applications or to your infrastructure last benefit could be efficiency or faster time to deployments when using giops you don't have to manually run the commands reducing the time that it takes to deploy your changes or your updates it's time for Hands-On project at this point I am hoping you understood what is giops along with different benefits of it if you didn't understand it let me know in the comment section that this video has helped you understand gitops let's go with practicing itops in action using Argo CD and deploying a game on kubernetes all right so I'm here on my computer screen and let's start with deploying a Tetris game on elastic kubernetes service using Argo CD so we will go ahead and create a cluster to create a cluster you can go to elastic kubernetes service in Amazon Cloud and then click on create for this let's name this cluster as kops and I'm going to choose the version which is the latest one this is the rule for the cluster and click on next option here for VPC I'm going to choose the default VPC you can choose any one and I'll avoid using my private subnets so let's choose the public one okay for Security Group I'm going to use my uh Security Group which is this one you can choose any and let's go ahead with creating next no need to enable logging add-ons I'm going to keep the default once let's click on next and this is going to create our kubernetes cluster kubernetes cluster usually takes 10 to 15 minutes to create so we have to wait for it to be creating so that we can go ahead and add our nodes till the time this is going to be created let me show you this tetr scheme Docker images created on my Docker Hub which we will be using in our manifest file we will be using this image on dockerhub to deploy our tedra scheme I have the Manifest file ready in my vs code and don't worry I'll be sharing this with you on GitHub the link is going to be in the description so we have a deployment file which is using Tetris uh as an image and we want this to be deployed through Argo CD automatically using gitops along with this deployment to expose it I have a service file and this two manifest file are inside a folder named as Manifest we will have to create a GitHub repository similar to what I have here so I have a GitHub repository created you can also go ahead and folk this repository or clone the code to use the same so in this manifest folder I have two manifest one for deployment one for service deployment is using the uh first version of Tetris and we will then deploy the second version of Tetris we want the Argo CD to automatically deploy it using gitops so I will wait for this cluster to to come up in active State then go ahead add the node groups and install Argo CD on it I'll pause the video now and come back when it's ready okay now the cluster is in active State let's go ahead and add node group so I'm going to go in compute section here and click on ADD node group we can name this node groups as anything let's name is nodes and for the IM rule I'm choosing the Amazon eks node Ru click on next option here and for the instance type we will have to choose something in the medium because Argo CD requires a server with 2 CPU and 4GB of RAM and that you can get only in medium if you choose to go with micro which is the free tier application you cannot install Argo in it so we will go with the medium which has two vcpus and 4GB of ram which is required for Argo CD installation so let's add that and click on next so we have two nodes of T2 uh T3 medium we will select the subnets click on next option here and then create this node group node group also takes some time so till the time node group is going to be created so let's go ahead and connect our cluster with the terminal for this you need to have Cube C installed and if you don't have it installed you can go to the official documentation or you can check my previous videos which has the commands to install Cube CTL so once you have your Cube CTL and AWS CLI installed you need to connect your cluster with the terminal and I can do that by running this command which is AWS eks update Cube config D- name cluster name and the region let's press enter and this will give you an output saying added new context and you can now run Cube CTL get pods to get the pods in your C we will see no resources found because we don't have anything created yet let's go ahead and install Argo CD for installation I'm going to use this documentation and the link for this will be in the description so you can go ahead and copy this commands which will create namespace Argo CD and install AG CD with the Manifest files so copy and paste it here so as you can see it has created name space and also creating all the other stuff which means Aro CD is installed you can optionally go ahead and install the Aro CD CLI as well to manage your applications on Argo CD through CLI but I'm not going to do that let's move ahead with exposing the Argo CD and this is the command which will create a load balancer and next we can run this command to put the DNS of the load balancer in the Argo CD server variable and it has to take around 2 to 3 minutes because load balancer takes time so I'm going to copy this after some time I can run this command when the load balancer is ready just to show you let's come back to our ec2 dashboard and go to load balancer to see if any load balancer is in creating state date or not as you can see there's a load balancer created right now which is uh 152 or 153 so after waiting for 2 minutes you can run the next command which is to put the load balancer DNS in this particular variable so I'm going to run it and press enter so it's giving me an error because I don't have JQ which I can install by running this command Okay so JQ is installed and I'm going to run the same command again which is to store the load balances DNS in the Argo CD server once I do this you can confirm by running Echo dollar Argo CD server and you have the load balancer DNS here which which means it works now let's go to the next command uh which is to put the password in this particular variable which is Argo PWD so I'm going to copy the same thing and paste it in my terminal this will go ahead and save uh my password and you can confirm by running Echo aroor PWD so this is the password we will be using to login and to login you need to copy your load balances DNS and paste it in a new tab once you paste it you should be able to see this page which says connection is not private click on Advance section and proceed to this link which will open up Argo CD UI this is what it looks like we need to log in and for the login username is always admin password is the same which you have stored in your Argo PWD so I'm going to copy this password and paste it in the password section here this should log you in inside your Argo CD and here you go we are logged in this is how the UI looks if you want to manage anything through Argo CD may you need to create an application but before I do that I need to connect my GitHub repository so that Argo CD should use kops to manage any change we are going to connect our repo using https so I'm going to say connect repo with https and project name could be anything let's choose default the URL is what you can get from your repository I'm going to go to my repository you can choose to fog this or use the use my as well because this is public so I'm going to copy and paste this in my Argo CD configuration this is optional because this is a public one if it was Private you need to put the username and password so this is all you need and click on connect once it is connected it should show successful which means you have successfully connected your repo and now Argo is going to fetch or sync from this particular EO so let's go and create an application so that Argo CD can manage deployment of this CIS on eks cluster so for application name I'm going to name it as Tetris make sure the name is in lowercase because it does not support uppercase for project name I can name this default choose default for sync policy you can either choose manual or automatic or you can also try to sync here if you want to do it manually uh all the other options are complex and if you want me to explain this let me know in the comment section to create a new video but I'm not going to explain you this for now which can make this video longer so for now repository URL is the same that we have used so I'm going to select the tetris game.get which is going to use the main branch of our repo and path is where are your manifest files so in our repo the Manifest file is in this folder which is Manifest folder so let's add let's add the name which is Manifest and cluster URL is going to be the option that you have here by default which is kubernetes default. SVC namespace you can choose to use the default namespace or if you have any particular namespace you created you can add that for now I'm going to choose the default namespace and this is all you need let's click on create option this should create an application and automatically deploy our application on the kubernetes cluster just to let you know uh we don't have any pods and I can show you Cube CTL get pods as you can see we don't have any pods once we apply it Argo CD should aut automatically fetch the deployment and deploy the application here so I'm going to create it and you will see that an app has been created it is syncing and now progressing once it is done you can see it has been synced and now it has created deployment as well as service this is also using the commit which is version one commit if I click on this it should open the commit which is this so now we are using the first version of Tetris once it is created you can access your application through this service endpoint which is a load balancer uh DNS because we are using load balancer as a service type here as you can see so we have to wait for some time because load balancer takes usually 2 to 3 minutes once it is ready we can open this in the new tab and we should have our Tetris application deployed Tetris game deployed on our cluster once this is done we are going to update image to use the new one and giop should automatically sync it and have the new version created so let's wait for some time after waiting for some time you can copy this and paste it you can copy this and paste it in the new tab and we should be able to access our Tetris application you can see it's here so let's play Let's play some Tetris so you can see this is our app this is our game uh and you can play it if you want or let's move ahead with changing the version type so now I'm going to go ahead and make the change so this is our first version of the game if I want to have a new version which means I need to change the deployment to deploy new version of application I'm going to change the deployment file in the Manifest and rather than using Tetris version one we will be using the tetris V2 after making the change kop tool Argo CD should automatically detect it and deploy the new version so let's go and make the change here in the GitHub and rather than using Tetris we are going to say V2 let's commit the change by saying version two and commit this change once you do this we can come back to Argo CD and check all right let's see if the new version has been deployed now that the giops is using new commit which says version two so I'm going to click on details option here and open this endpoint in a new tab okay as you can see this is the new version of Tetris and this is how giops actually syncs your git repository to detect any changes you have made and automatically deployed I hope this video has helped you understand what getop says so there you have it this is how simple it is to deploy an application using gitops and if you have any questions about this let me know in the comment section now here's the challenge now now here's the challenge I want to deploy the other projects that I have in my YouTube channel using Argo CD now that you know how to deploy it I hope this video was informative if you have any questions any doubt let me know in the comment section thank you and have a good day bye
Info
Channel: Cloud Champ
Views: 11,809
Rating: undefined out of 5
Keywords: gitops tutorial, gitops argocd, what is gitops, gitops explained, gitops argocd kubernetes, gitops project, gitops kubernetes, kubernetes gitops tools, how gitops work, benefits of gitops, why gitops, gitops tools, gitops flux, gitops project argocd, gitops deployment, git ops, gitops terraform, gitops devops, how gitops is used, gitops nana, git, how gitops works, argo cd, flux cd, argocd, what is git ops, devops, cloudchamp, kubernetes gitops, gitops, aws, argocd tutorial
Id: 1hF-HRq5Mww
Channel Id: undefined
Length: 15min 51sec (951 seconds)
Published: Sun Oct 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.