Kubernetes for Orchestration Deploying Containerized Applications to Kubernetes Cluster

GeeksforGeeks · Beginner ·☁️ DevOps & Cloud ·1y ago
Skills: Kubernetes85%

Key Takeaways

Deploys containerized applications to a Kubernetes cluster, introducing Kubernetes fundamentals

Full Transcript

Yes. So, hi everyone. Uh, very good evening to all of you. I hope I am audible. So, let's get started with day number three, the final day for this uh workshop from Geeks for Geeks on DevOps. So today we are going to cover genkins as well as Kubernetes and we are also going to cover uh the practical. Okay. So the goal the goal for this particular workshop was that I will show you uh an end to end devops pipeline and then we will be deploying a full stack application on EKS cluster or you can say on Kubernetes cluster. Okay. So let me share my screen and let's get uh started. So just give me a second. I hope I'm audible right? Can anyone confirm in the chat box? Okay. So just give me a second. Let me start sharing my screen. Okay. So in the last session uh we were discussing about docker and we have also discussed what is this uh devops platform and then today we will be discussing about kubernetes. Okay. So I will give you a very quick small revision of the last session and then I will start uh ahead with the today's agenda. So till now we we are aware that what exactly is a DevOps pipeline and then we have also seen in the last few sessions that if you wanted to deploy any of your application okay you want this application to reach to your consumer your end consumer okay so this here will be my end consumer let's say the consumer will be in your production system so you want your application to re to reach to your production system to your consumer so in that case we have to follow a particular process If we don't follow this kind of process then we may deploy uh a bug related application to in front of our consumer and that will be a very big issue because that's not a uh that's not a good way of deploying an application and it's not a good reliability as just give me a second guys I'm getting a Okay, I hope you guys can see me as well now. Okay, so our main focus is to take our application uh from our development environment. So your developers will be creating your application in the development environment and from this development environment we will take our application to our production system. So we faced couple of issues over here. Then we have identified that we are going to create one pipeline CI/CD pipeline and with the help of the CI/CD pipeline we will make sure whatever application we are deploying to uh in front of our consumer that application is bug free that application don't have any uh as such issues and that application is reliable as well and good in performance okay just give me a second guys I I can see that again you guys are trying to draw something on my screen okay so give me a Okay. And just one more second. Okay. So I hope now it should be fine. So that is our main agenda. So we discussed that the entire infrastructure we are going to achieve from AWS cloud. AWS is one of the public cloud provider. They are going to provide us the entire infrastructure. In top of this infrastructure, we will deploy uh our operating system or we will create our operating system and behind the scene this AWS will be using virtualization technology and via virtual technology they will be providing us this operating system. Once we have this operating system in top of this operating system we are going to deploy our application. Okay, that is a final flow. But the only only manual approach which we are using over here was that once our operating system is ready if you wanted to deploy your application you have to first test your application. So in the last session I have shown you how it can be done in a manual way. So I have shown you that we have created a virtual machine inside that virtual machine I have installed the Python. After installing the Python I have installed the Python pip manager. Okay. PIP package we have installed that is your Python uh package manager. After installing pip, we have installed all the python uh related uh dependencies. So whatever dependencies you are using in your application. If you're using python, you may be using flask or you may be using dash, you may be you may be using pandas or numpy or something. So all all of our dependencies you are going to install. And once your dependencies are are been installed over here, then you may have to copy your entire code that is a compulsory option. You have to copy the entire code which you want to be run. And then you may have to do some settings or configuration in your python application as per uh your requirement. And then finally you will run this command and your python server will start. So we are doing these many things behind the scene which which will take some time because you are doing it step by step. And that's why scaling your application will be very slow. Why? Because if you wanted to create exact same replica of this particular server then you have to again repeat the same process and we don't want to repeat it. That's why we discussed about containerization technology. In containerization technology what we can do we can create all these steps one time and then we can bundle this together. Okay. And we can call it as our image. Okay. And here we are using docker as one of the contrast uh tool. So here we will call it as docker image. Okay. You can also call it as docker bundle which we have created. What is this bundle? This bundle has everything which is required for your application to work or you can say it is a template you have created. Once you have this template created now from this template you can create or you can run your application without any issues. Okay. Because you have the entire template ready just in a click within a second your container or your application or running instance of your code will be ready and that's what we have achieved in the last class with the help of contrasting technology. Okay. So if you go back to one of the repository here in our GFG workshop 2025 you will see I have attached uh uh two more repositories information over here. Okay. I have also added some documentation. So whatever command I was running in in Linux virtual machine in the last class. I have took the history of all those command and I have put it over this file. So from this particular file you will be able to find out all the commands which I have executed in my last class. So if you also wanted to replicate the same you can do that. Okay. You can you can find out the entire command history like these are the commands I was executing step by step. Everything you will be able to find uh over here. Then you will see for DevOps basics these are some of the basic information about DevOps. Again you can go with this readme document and you can understand the topic and then uh here in the readmi file I have given you two uh repository link. This is one of the repository where uh we have hosted our flask application and this flask application also had its own test file test cases. So before deploying this flask application we were also running our test cases in the last class. Now we will automate it with the help of CI/CD pipeline. Okay. But in the last we have also created one docker file and this is very interesting because this docker file has our entire package. This docker file has everything which is required for my application to run. Okay. Okay. So for my application, Python was required. Pip 3 was required. Okay. I have to install all the package packages dependencies of Python that is also present. Okay. And then we have defined that it will be running in a port number 500. Although it is uh mostly running in port number 5,000. By mistake I have used 500 over here. And then we discussed that can we please install or can we please perform all these steps while building my image. So building your image is a onetime process. Once your image has been built, you can share your image with other colleagues, other people. You can also host your image to docker hub. So we have seen that practical as well. I have logged into my docker hub account. In my docker hub account, I have uploaded this particular image. Now anyone who will pull this image and then they will run a container from this image. Within a second, my entire server will be up and running. Similarly, I've shown you one practical for this Mario game as well. Okay. So this is one of the repository which has a source code for Mario game. Now it's not the complete source code for a Mario game. Someone tried to replicate the Mario game in a uh via JavaScript. So in your web browser you can replicate the game. So here there's a basic code for on JavaScript client side JavaScript has been used over here. So if you wanted to deploy this application what we did we are if you go back to docker file we are using engineext as one of the base image. So engine server we are going to create and then we are saying engine server is saying that can you please provide me all of your web pages all your of your HTML CSS JavaScript file which is required for your web server to run. So till now whenever I was creating my web server I was creating some very simple file index html file I was creating right so if you see uh go back to this repository I was using this index html file this index html file just had a simple heading or simple paragraph but here in this particular case whatever data I have that is complete HTML CSS JavaScript combination and okay all these data are present in this particular folder Mario game so we are doing a copy instruction over here we are saying entire source source code. Can you please copy inside my docker image? Okay. And in docker image also uh this will be copied at this particular location because your engine server will look for your web pages from this locations. We are copying it over here and then we will say my application will be exposed on port number 80 and then we have started our application. That's what we did right. So guys anything anyone have till here any questions any questions specific to whatever we have discussed from last two classes you can ask okay otherwise uh we'll start with genkins uh over here so I hope you guys are able to understand this topics can you please confirm okay so because this is a base for today's practical okay so s if you have if you will are two docker instance of Mario game. Okay. So what will happen? Two process will start basically in your operating system. Okay. So in your operating system two docker containers you are running. These docker containers are nothing. It's just like a process. Okay. So internally inside this container your program will be running at port number 80 because we are using engine server. Here also it is running at port number 80. But if you want someone from the outside world to connect to these particular containers, then you will have to do a port mapping because right now as I discussed earlier as well, each container will have their own IP address. So this one will have their own IP address. Let's say 172.17.0.3. This one will have their own IP address 172.17.0.2. So until you are in your base system where you have installed Docker. Okay. So you have you are in your base virtual machine. In virtual machine you have installed Docker. Then in top of docker you have launched two container with the same image that is fine but both the containers have their own different IP address. So if you are in your base image sorry base operating system from here if you wanted to connect to your server you can do it. You can use skull command you can use this container IP address and you can hit to port number 80 you will be able to connect to this container. If you hit on this particular IP address at port number 80 you will be able to connect to this container. But if someone who is outside of your EC2 instance, someone who is outside of your of your server, means your client who is somewhere on the internet, if they wanted to connect to your application, so they can't directly connect to your private IP address. They will have to connect to a public IP address. And in this case, they will connect to public IP address of your EC2 instance, your virtual machine. Your virtual machine or the operating system, okay, will have a public IP address. This public IP address will be in range like 200, 6,4.3, whatever, whatever range. So he is going to connect on this particular IP address. But once he will reach to your operating system, this is operating system. In operating system, hundreds of processes processes are running. How your kernel will decide in which process I should divert this particular request. That's why here you will have to do a quote mapping. You will say anyone who will come to your base opery system. Anyone who will come to me at port number 81. Any port number you can do. So now this port is open on your operating system. So we are saying anyone who will come at port number 81 of my base system he will be mapped with or his request will be will be proxy to my this particular container and anyone who will come to my public IP address at port number 82 for example then he will be mapped to this particular container or this particular service which is running over here and we can't have two process mapped with same port number it's not possible the same example like in in apartment we can't have two flat with the same number okay that's why we will have to do port mapping over Okay. Uh so Prashant just wait for a minute. Let me first complete Genkins. Once I will complete uh Genkins then when I will be showing you the end to end uh project then you can try doing. Okay. We haven't started Genkins yet. Right. So let me start genkins. I hope sah your question is clear. Right. Anyone else have any doubt? So now we have uh we have a very limited uh serious uh students in this particular uh class because from last two days we were seeing a lot of people were doing spamming over here right so we have removed all of them to make our experience better okay so let's get ahead and let's learn uh more about our CI/CD pipeline so I'm going back to my AWS cloud here I'm going back to my E2 service and And today I'm going to launch one more EC2 instance. And then in this EC2 instance I'm going to perform some kind of setup. So I will launch it. Okay. So by now if you would have done some practice after the classes so you will be aware how to launch IC2 instance. The steps are very simple. We will have to give a name. Let's say GFG server. Server one for example. Okay. Then which image file I will use? So let's say I will go with Amazon Linux once again. Which instance type? You can go with T2.micro. But because I'm going to configure or run a genkins server over here, so I will recommend you to go with T2.mdium because T2.mdium instance type will give you two core CPU and 4 GB of RAM. T2.micro is giving you only one core CPU and 1 GB RAM, which is fine for your basic practicals. But if you wanted to run a genin server, it will need more RAM and CPU. I'm going with this particular instance type. And now this instance type is not under free tier. So if you use it, you will have to pay. That's why what I will recommend that if you want to do this practical, do it. Once your practical is completed, delete it. Okay? So if you use it for a certain duration of time, they will not charge you. But if you keep keep it running for a long long duration, then they will start charging you. Okay? So I'm going to use medium because I will have a better performance. I will have two core CPU and 4 GB of RAM. Okay. And then in the key pair I will select any key pair which I have created. I think the key pair which I have I created in the last class was something like GFG workshop. This key pair I'm going to select. And in the network settings guys I'm going with all the by default right now. And in the storage I will say 8 GB should be enough but let's say I will give 15 GB of SSD over here. Why I'm giving more hard this? Because today we are going to do a lot of setups over here. So I want a better performance. I don't want my system will start doing will start getting hanged. So that's why I'm giving some more resources over here. But if you will go with 8 GB, 8GB will also be enough. Okay. So from my end I'm going with 15 GB to make it more better. So more storage I'm giving to my EC2 instance. Okay. So s first of all these two are not instances they are docker containers. So if you want to do a code mapping, so what we did in the last class, the command was docker. Whenever you use docker run command to run a container, we have a option hyphen P over here. This hyphen P option is doing the port mapping for you. This is the one which is doing the proxy for you. If you remember, we were doing something like this. Port number 80. Let's say port number 80 means anyone who will come to my base system at port number 80, he will be mapped to port number 80 of my container or you can say port number 8080 uh column port number 80. This is the port mapping. When you launch your container, if you pass this particular argument, then the port mapping will be done. Nothing else you have to do. Okay. So now you can see my instance is getting ready. Let's log into this instance. Let's connect. What happened? Yeah, let's connect over here. So I'm directly connect on this particular web UI. Okay. What next thing we will do once our EC2 instance uh will be up and running. I will log to my root user. Okay. And then we are again going to install Docker. Yum. Install Docker. So I will need Docker uh in today's class as well. So I'm going to install Docker. And once Docker will be installed, now we are going to set up Genkins over here. Okay. So if you want to know more about Genkins, go back to your browser, search for Genkins. So let me go back here and search for Genkins. Okay. So you will see this is the official website of genkins and genkins is open source guys. Okay. So the there's a very great community which is working behind uh genkins. Okay. So it is open source but they are providing you an automation server where you can automate everything. You can you can create the entire CI/CD pipeline. Okay. So they're saying it is very easy to install genkins. It is very easy to configure genkins and genkins has a very great integration with all different kind of tool. So you can integrate genkins with kubernetes with docker with git with sonarq with almost all the tools genkins can be integrated. You can see here they are telling uh it is for continuous integration continuous delivering or deployment. You can say genkins have lot of great plugins. So these plugins are the one which helps your genkins to uh integrate with other kinds of programs or tools in the market. Okay. So if you wanted to create genkins server you can install this genkins directly into your windows system as well. You can install genkins in Linux as well or Mac as well. Okay. But again in real world we will be using Linux only. So in this class as well we are going to see how genkins server can be created on a Linux operating system. In Windows also you can do for testing purpose. But if you wanted to have a real world kind of feeling then please do it on Linux operating system. Okay. So this genkins is built on Java. Okay. So this genkins is written on Java you can see. So Java programming language they are using behind the scene. That's why if you wanted to wanted to install genkins, what you will have to do? You'll have to first install Java JDK in your system. Okay. Once you install Java JDK in your system, then you can install Genkins program. Once you install Genkins program, then you you will have to install some of the dependencies of Genkins as well. And then you will have to do some further configuration over here. Okay. So just for installing this Genkins server, we have to perform so many steps in our base system. We must have a Java support. We must have a Java JDK installed. Java development kit. Okay. And then we can install uh Genkins. Okay. So once we have this entire uh configuration ready, I can say my Genkins server is up and running. Okay. That's what we will be doing. But you can see if I wanted to configure Genkins directly on my virtual machine. I'll first install Java JDK. So many things I will be doing. So to make it simple what genkins community people have done they have also created one genkins docker image okay and they are saying that if you wanted to create genkins server and you don't want to do all these things step by step by by your end okay then you can directly use this particular image which I I am giving to you this as you will download this image or pull this image and from this image as you will create your container the container will have your Jenkins server running you don't have to do any much configuration from your end okay so this is like they have Again they are again giving me an image. In that image they have put everything which is required for genkins server to work. Okay we are going to pull that image and from that image we are directly going to create our genuine server. Okay otherwise you going to do directly on your base system you have to follow a process. If you want I can show you some additional document for that. But right now I will be again utilizing the power of docker over here. Okay. So if you remember in the last class we were doing one practical and we said docker in docker we have a docker registry. This is a registry hub.docker.com where you will find all different kind of images. Even you can create your own account and you can also push your images. Okay, your application images like one of the image GFG sample uh image we have pushed in the last class. So here I will search docker. Do you have anything for genkins? Okay, genkins. Okay, so Docker will say yes, I have one image available for Jenkins as well. If I search, you can see this is the image genkins. Jenkins and this image again they are saying it is by genkins community only the leading open-source automation server okay and they have more than 1 billion downloads means we can rely on it on on this particular image so I'm going to launch my genkins server via this image if you want to create your genin server you can directly install it on your base system your virtual machine as well okay directly but I will be using docker over here so I will first pull this particular image docker pull genkins/ jenkins I will pull this image. Okay, I will go back to my EC2 instance. Where was my S2 instance? Here is my EC2 instance. I will start my Docker engine because I have just installed Docker. I haven't started it yet. So, I will I will have to start it. Then only it will start working for me. And once my Docker engine is started, now I'm going to run this particular command. So, this command is going to pull my Jenkins Docker image from my Docker hub to my local registry to my local virtual machine. Because once you have this image pulled into your local machine then only you will be able to launch some containers. Okay. So I I will do docker images. So what you will see my image is currently being stored in my local registry. Okay. And this is my centralized registry which I was using earlier. From here I have pulled this image. So what it will do for me? It will help me to do a continuous integration uh uh deleting the server. So it will help you to create a continuous integration uh pipeline. Okay. They are saying you can pull this images and then they they have also attached one documentation. If you click on this documentation link it will open the official repository of genkins. As I mentioned genkins is open source. So from this repository if you wanted to do any open source contribution you wanted to contribute something on genkins. You can do that. This is the entire repository which has a source code of genkins. How exactly genkins work behind the scene. Okay. So right now they have opened a readmi file. From the readme file they are giving the command docker run command. And this is a port mapping option hyphen P. Okay. So here you can see they are giving me the port mapping option. They are saying if someone from the outside world wanted to connect to your Jenkins server. Okay. So they can come to your base system at port number 80080 and they will be mapped to 8080 port number of your container of your Jenkins server because Jenki server usually runs at port number 8080. So you just have to copy this particular command and you have to go to your EC2 instance and we can run this command over here. Okay, in this I'm going to add a small uh step. Okay, so I'm just going to give a name as well to this particular particular uh you can say container. I'm going to give a name let's say Jenkins as one of the name. Okay. And then I also wanted to run it in detach mode. So I I'm using hyphen d option to run in detach mode. If I don't run in detach mode, it will run in foreground and it will eat up my entire terminal entire everything will be open. all the blocks of this particular container will be open in front of me and I will not to use my terminal. So I'm running in detach mode but I also wanted to have an interactive terminal so that I can go inside this particular container. I can get the terminal of this container that's why I'm using hyphen id over here. Okay as I will run this you can see in a second. Okay I think I have pulled the wrong image last time. So whenever you you try to pull a image or anything if you don't give any tag if you don't give any tag then they will pull always the latest. They will automatically consider you are talking about latest tag. But in this case I'm using one of the tag called is LTS. LTS means long-term supported version. So what my genkins people have done because they will keep on updating that their genkins server. They will keep on updating their repository, their code. Okay. So what they have done they have marked this particular version of Genkins as LTS long-term supported means they are saying that this particular version of Genkins is properly been tested by so many communities and we have got always a positive result. So they have tagged it as LTS version means you can rely on this version. this version will will it's very less chance that this version have will have any bug and all okay because whosoever is a developer of genkins basically it's a community what they will do they will keep on uploading they will keep on pushing us pushing the new changes you can see just 7 days back they have updated this particular image so in the newer version of this image they might have some bug or it might be in beta phase they might be testing it okay so LTS is one of the version which you can rely on which is properly being tested so if you just check the tags so many tags are currently available. We are using let's say this one or I can use some other as well. Okay. Now once my container is ready if I docker ps you will see my container is right now running and they are saying anyone who will come to my base system my virtual machine at the public IP address. This is a public IP address. I will copy this IP address. Okay. Hit it over here. And anyone who will come over here at port number 8080. Okay. You can see here is mentioned 8080. Then you can see there's a arrow icon over here. This anyone 0.0.0 means anyone in this world comes at port number 800 of my operating system. Then they will be mapped to my container. In my container, the program is running in 80080. So as I will hit it, I will be able to connect. But you guys are aware my security group will again block me. So let me go back to my security group rules and let me allow this particular uh port number. So when I select this instance, I will go to security section. I will go to my security groups and I will allow this traffic. Okay. And then I will click on edit inbound rule. And guys, let me do one thing. Let me allow all the traffic. So in the last class, you would have seen that I was updating this particular security group so many times, right? So if you don't want to do it, you let's say for testing purpose, we in development right now, you can allow all the traffic to your EC2 instance. Just for now in production system we don't do it. In production system we allow only do but traffic which you thinks are important. Okay. So you will have to keep updating your rule. Right now just to make it simple I'm allowing all the traffic and I'm clicking on saving uh save the rules. Okay. Once it is done if I go back you can see it's now I'm able to connect and they are saying your genkins server is ready. Genkins will give you a web UI. From this web UI you can manage uh the entire genkins server. And they are saying that if you wanted to use this genkins first of all you will have to prove your identity and for pro for proving your identity they are saying in the docker container which you have just created in that docker container there is a file which is stored at this particular location where/jenkins home secrets and initial admin password and at this particular location I have given some initial admin password. If you give that initial admin password over here then only I will let you proceed and then they will give us a prompt as well to update the password. So this is you can say a by default password which has been set just to prove my identity I will have to give the initial password and if I give the right initial password then only they will let me go ahead and then only they will let me proceed the installation of genkins. So I will have to go to my container. In this container I will have to find out the uh content of a file located at this particular location. So I will copy this. Okay. And I will go back here. Now you can see my container is running. Right? In this container if you wanted to go inside uh this container then what will happen? So let's say if I say docker I wanted to attach to a container. We we discussed about attach command. So if you have a container which is in running state and you wanted to attach to the program which is running inside that container you can use attach command and then I can give my container name or my container id. In this case my container name I have given as genkins. You can see genkins as a name. So I will as I will do attach command you will see one and this is very important concept which you need to understand in docker. Okay, whenever you use attach command, what it does? It attach you to the to the program which is running in that particular container. In this case, in my container, there was some genkins server program may be running. So, I have been attached to that particular program. But I wanted to attach to a bash program because bash program is the one which gives you a terminal. From the terminal, you can run some command ls command, date command and all these. So attach command will only take you to the command which is running inside that particular container. To give you a demo let me you can see these are these are the things I'm just pressing pressing Ctrl C right now. If I press Ctrl C so what you will see whatever command I was running okay they it was it was uh closed. I did control C it was it was closed. But because while launching this container I have added one tag that whenever there will be a failure you can restart the container. You can see hyphen - restart equal to on failure. So as I did control c my container was stopped but as it was stopped my token has again started. You can see just 5 seconds back token have started it. Okay. So let me show you this particular command attach command what it does. So if I create one more container docker run let's say hyphen it. Okay. And then if I use Amazon Linux for example, this is the image I'm using right now. As I will enter this image is not present. So they will first pull this image for me and from this image they are going to create a container. Okay. So you can see as this container was created they took me to the bash shell. Why they doing to the bash shell? Because in this this particular image is providing the bash program as one of the output. Genkins was providing the their genkins. my Python image which I have created in my last class. Okay, if you go back the Python uh which we have created, it is providing you a Python server as output. It's not providing you a bash program. Okay, so attach command will always take you to the command which is running inside your container. The main command which is running inside your container. So if I will try to come out from this container with a with a escape sequence control + p + q. Okay, we have discussed about it. And if you see docker ps now if I do docker attach and I attached to this container whose name is amazing something like that they have given some random name. Let me copy this and paste it. So you can see they have just attached me because in this particular container bash program was running. So they just attached me to that particular program. But in case of genkins they are not running any bash program. They running something else. They are running some genkins server. Okay. And here I wanted to go inside this particular container and I wanted to go inside this container because I wanted to execute some command. So I will need a bash program. So how can I do that? So for this you usually have one more command that is called as docker execute command. So whenever you wanted to go inside a container and you wanted to execute something else some other command other than the main command which is running in that container. So instead of you using docker attach you should always use docker execute because whenever you use docker attach command it will always attach to the main command which is running in that container. As a docker, I wanted to go inside this particular container whose name is genkins and I wanted to have an interactive terminal because I I want the bash program over here and then they will ask me which command you want to run inside this container. Do you want to run ls command in this container? You can see as I do this it will go inside this container execute the ls command and then come out from that container. Okay. Then they are saying what command do you want to run any kind of pwd command which will show you present walking directory. So what it does it went to my container executed this command and then come out from the uh from the container but in my case I want to run a bash program as I will run the bash program you can see now I got the terminal of my genkins server okay which is running so in my genkins right now there's there server is also running this is a command okay but I have opened one more command one more program one more process that is your bash process and this bash process is going to give me or provide me the terminal of this particular particular container And here I wanted to execute cat command. Why cat command? Because this is a file where they have stored the initial admin password. I want to read the data in this file. I will use cat command to read this file. As I will read, you can see this is the initial admin password they have set. I will copy this and I will give it over here. And then I will say genkins this is the initial admin password which has been set. And genkins will say you are giving me a right password that's why they will let me sign in or what happened? If I'm not giving a right password, they will. Okay, it works, right? Let they let me sign in over here. Then the next step is genkins ask that do you wanted to install some plugins. Okay, so either you can decide what kind of plugins you want to install or some community people have already selected some mostly used plug-in. Okay, these are called as suggested plugins. These are the plugins which are mostly used by the community. So they are saying do you want to install plug-in by selecting by yourself or you wanted to install all the plugins which comedies have found helpful. So let me go with install suggested plugins. So it will install couple of plugins for now what is this plugins? This plugins are the main backbone of your genkins. Okay. Because genkins is an automation server. The only work of genkins is genkins is the genkins will need to communicate with other programs. Let's say here Jenkins will need to communicate with GitHub because I want as my developer will push the code to GitHub, my Jenkins should should know that there's a new code in my GitHub. Genkins should all automatically pull that code and Genkins should start doing the testing of that. Then I want Genkins to build a docker image for me. I want Genkins to connect with a sonar cube server which will do a analysis of my code. So again genkins will need to connect with sonar cube for that. So that give you a separate server guys which helps you to identify the quality of your code. Similarly I want gen keys to connect with docker so that so that my docker image can be built dynamically. Last time I was building docker image manually. I was using docker build command and then I was building it. But I want as my testing will be completed automatically my docker image should get built. I don't have to do it manually. So again genkins will need to communicate with docker as well. In future genkins will need to communicate with the cubities as well. So these all are different different tools like that's why DevOps is called as umbrellas of tool. Okay, umbrella of tools. So DevOps has so many tools. Now if you want to integrate all these tools then you can do it via Genkins. And why? Why? Because we want to create a seamless pipeline over here. Okay, we want to have an integration of them. Okay. So by default Jenkins don't know or don't have support for them. But with the help of plugins, Genkins got to know that okay how to communicate with a particular program. Let's say here you can see g plug-in is getting installed. Jenkins will know about g plug-in. Jenkins will know about email. So let's say you want whenever I'm running a pipeline if my pipeline failed I should get a email notification that your pipeline was failed. So you will need to install this email plug-in over here. So as per your requirement you will keep on installing the plugins. Okay. The next thing is they are asking me to set up my own uh username and password. Okay. So now I will set up my own username and password. And this password uh I'm going to use further okay as a test@gmail.com. I'll click on save and continue. And that's it. My genkins is now ready. I can start using my Jenkins. Okay. So that's what we have done. This is the exact web server which uh genkins is going to provide you. Okay. So I can see in the chat someone is saying that you got some cost. Okay. So you can connect with me regarding that uh separately. I will give you a format for email and that email you can send it to AWS support team. They will help you to fix it. Okay Siddhant I'm not sure if there's there is a meeting will not be sent by my team. I can check with my team. I'm not aware about it. So for 2 three hours it would be very uh minimal I use you can just imagine it could be 100 150 rupees something like that very minimal okay okay so okay okay so you are saying uh you don't understand what genies do so if you were there in my last class um you will remember what I was doing with with the my manual setup was once your code is been developed by your developer. I was saying that we have to test this code. Okay, we have to check the quality of the code. Okay, and for each of these are the individual steps which I wanted to do one by one so that I can prepare my code for the deployment. Then I was saying once the quality is been done, please check the linting of the code. Okay, linting means whether the code is following all the Python standard or not for writing it. Similarly for Java standard or not for writing the code. Then we were saying that once your code is ready now I can try to bundle my application so that I can further deploy my application. Okay. So for bundling it what we discussed we are going to use docker over here. So we are going to create one docker image which will bundle my application. Everything which is required for my application to work I will bundle it and then this bundle I'm further going to use for the deployment deployment purpose. Okay. So right now I have just mentioned very small small steps but in real world there will be so many steps you have to do one by one. Okay. So if you want to do a testing what will you do or before testing you also have to do one thing you have to install Python. After installing Python you have to install your pip. Then you have to install all your dependencies. Okay. Then after installing dependency then you will do the test. So you can see now we have so many steps. I was doing all of these steps manually over here. But you you imagine in a team where you have hundreds of developers working on the same project and they are keep on updating their code. Is it possible for a human being to do these many steps manually every time? It's not. That's why we are using genkins to integrate all these steps or to put all these steps over here. So genkins will automatically do this. I will show you a practical then you will get a more uh idea about it. So sad wait for some time. Let uh let's see a practical with Jenkins and you will get uh an option. Okay. So you will get to know what uh genkins is doing. Okay. So once my server is ready, you can see my gen server is now ready. I'm going to click on new item and I'm going to say genkins. I wanted to create a pipeline over here. I will say Python pipeline over here. And then I will select my type as pipeline. I wanted to create a pipeline. Pipeline means you will have multiple steps and you want to integrate all these steps. So I'm going to select pipeline. Okay. Just just select this option once I will show you the practical everything that will be clear why we are using genkins. Okay. Now genkins will give you so many so many columns or datas over here. Just ignore them right now. Okay. We will come to them one by one whenever it will be required. Okay. Now here we have to give a genkins we have to give a gen pipeline script. Okay. We have to tell genkins I want you to do couple of things for me. Okay. So I'm going to write a script over here where I will tell that please download the code for me. That's the first step. Then please here also you can see we creating a template. Okay. So whenever you want your application to reach to your deployment or to your server, you are following a process over here. So you are documenting all this process into one file. Okay. That is called as your pipeline code. Okay. Pipeline as a code you can say. In this code I will say Jenkins what you need to do first you need to install Python then you need to do install pipe. Then you need to install all the dependencies. Then you have to perform test cases. Then you have to check the quality. Everything I will I will mention one by one to genkins. So for that genkins have their own syntax which gen understand and that is called as groovy. Genis understand groovy language over here. Okay. And you don't need to worry much about Ruby. Groovy is very similar to JSON. In JSON also what happened? We have curly braces. Okay. We have curly braces. We have a key. Okay. We have a value. Okay. Similar kind of format here also we will be having to create our pipeline script. This is your pipeline script which I'm going to create. What I will define this pipeline script. So you can try a sample pipeline like a hello world pipeline. So in this pipeline this is how your script will look like. Very simple. The first thing is I'm saying genkins I wanted to create a pipeline over here. So this is just a comment I'm adding. This particular keyword means I wanted to create a pipeline. Okay. Then in this pipeline there will be multiple jobs. So these stages or the stage keyword which you see here this means that you you will be having multiple job multiple work you have to do. Okay. And all these work you are integrating together. That's why I'm I'm putting them over stages section over here. Okay. And what is my first job? Okay. So my first job is let's say I wanted to execute one command. Eco means in Linux usually eco is used for printing something on your screen. So right now eco means it will print hello world in your screen. Okay. So here it will it is going to print hello world in your screen whenever you run it. Okay. So let me run this simple pipeline over here and let me click on save and let me click on build now. Okay. So what will happen if you click build now? Genkins is going to execute your pipeline. whatever you mentioned genkins is going to execute it and you will see genkins have executed my pipeline okay and right now if you click on that pipeline go back to your console output means output of the pipeline Jenkins will say I have printed hello world for you that's what you you wanted I have printed hello world for you okay now let's say I will say jenkins don't just do hello world now I want you to to uh take my code from my repository and then perform end to end pipeline you I want you to create you. I want you to perform end to end testing of this code. I want you to perform everything which is required for my application to move to production system. So pipeline or genkins is the heart of DevOps. Very important uh tool you can say for for DevOps. So so you tell me if you have a repository let's say this is my repository. This is my flask application. If I want this flask application to be deployed on a server currently it is on a GitHub over here. My developers have created the code. You can imagine and currently it is on GitHub. Now I want to deploy it on server. So I can't directly deploy it on server. That's what we discussed on the day number one. Okay. So I have to follow a process. So I will copy this URL from here. Let me just copy it from here. And I will say genkins can you please do one one thing for me. Can you first of all download this code. Okay. So I will say download the source code. Whatever I'm writing over here, this is just a sample string which will help you to identify what exactly your step is going to perform. Okay. So, I'm saying genkins do one thing. I want you to make my code ready for the production deployment. And if you want to do it, the first thing is you have to download the code. Because once you download the code, then only you will be able to test that code. Then only you will be able to check the quality of the code. Then only you will be able to run that code. First first step is you have to download the code. Okay. Then here I will say genkins I want to download the code from my GitHub repository. Okay. So here in your groovy Groovy syntax genkins have a way where the genkins can clone your repository. Okay. Download your repository. Okay. If you want to see the exact syntax you can click on the pipeline syntax. This will help you to create a pipeline because right now I'm going to create this pipeline manually. Everything I'm going to write one by one over here. But usually this pipeline syntax can help you to write your pipeline more frequently. Okay, let's say if you wanted to clone a repository. I wanted to clone a GitHub repository. I would say git do you have anything for cloning a repository? The g has one one keyword g over here. Select this and g will ask you. This is like a simple UI they are giving. If you just fill in all the detail details then this they will convert this particular data into a pipeline script. So if you don't want to run a pipeline script by yourself, okay, then you can use this kind of pipeline script generator here you can give they are saying what is your repository URL. I'll say this is my repository. You can copy your repository uh link from your GitHub. This is my repository link which I have copied. And then they are saying what is your branch name in which branch do you have your entire code. So in GitHub you can have multiple branch. Right now I have branch from main. In main branch I have all the code. Okay. So I will say I have a branch name and then I will click on generate pipeline script. So this is like your pipeline script generator and you can see they have given me a script as over here. They are saying copy the script and put this script in your over here. Cop paste this particular script. What it will do? It will clone your repository. It will download your repository. Okay. So this is the first job first thing which I'm going to do that is that is cloning the repository repo. Okay once the cloning of the repository is done then I will try to do the my next step. What will be the next step after cloning the repository? So I would like to install Python in my system because if I don't have the Python how can I test it? Okay. So these are the same things which we did in our last class manually. So if you go to my my workshop uh GitHub repository over here if you go to command history and if you see what commands I have executed in my last class to test everything you can see the first thing I did was cloning the repository. After cloning the repository what I was doing I was installing Python then I was installing P lot of things I was doing in behind the scene. Same thing I can repeat over here as well. Last time I was doing doing these things manually one time I can do but what if my developer has made some changes in the repository. So same steps I'll have to again repeat and for a human being it's not possible. It will be very slow. That's why we are using a tool over here. So I will say once you have downloaded the source code the next step what you need to do genkins is you need to let's say

Original Description

Flat discount active on all GeeksforGeeks Courses. Avail before the limited time offers end: https://www.geeksforgeeks.org/courses Register for free to attend more workshops on Full Stack development, Data science, AWS, Devops & DSA: https://gfgcdn.com/tu/UJ6/ ☸️ Curious about Kubernetes? This beginner-friendly tutorial introduces you to the fundamentals of Kubernetes, focusing on how to deploy and manage containerized applications using real-world examples. If you're learning DevOps, cloud-native development, or working with Docker containers, this is the perfect starting point! ✅ What You’ll Learn: What is Kubernetes and why it’s essential for container orchestration Understanding key components: Pods, Deployments, Services, and Nodes How to deploy a containerized application to a Kubernetes cluster Managing application updates, scaling, and service exposure Basic kubectl commands and YAML configuration files 🎓 Level: Beginner to Intermediate Perfect for: DevOps learners, cloud engineers, and developers exploring container orchestration and Kubernetes-based deployment strategies. 👍 If you find this video helpful, like, comment, and subscribe for more cloud-native development and DevOps content!
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from GeeksforGeeks · GeeksforGeeks · 0 of 60

← Previous Next →
1 How I got into Walmart | Shailesh Sharma
How I got into Walmart | Shailesh Sharma
GeeksforGeeks
2 Upgrade yourself In 29 Days | GeeksforGeeks
Upgrade yourself In 29 Days | GeeksforGeeks
GeeksforGeeks
3 Learn AWS Fundamentals For Free
Learn AWS Fundamentals For Free
GeeksforGeeks
4 Conversation With Young Achievers | Meet the winners of Bi-Wizard Coding Contest | GeeksforGeeks
Conversation With Young Achievers | Meet the winners of Bi-Wizard Coding Contest | GeeksforGeeks
GeeksforGeeks
5 Meet The Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
Meet The Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
GeeksforGeeks
6 Interview Prep Strategies | PayPal
Interview Prep Strategies | PayPal
GeeksforGeeks
7 OLX Interview Preparation Strategies | Hukam Singh
OLX Interview Preparation Strategies | Hukam Singh
GeeksforGeeks
8 Meet Some More Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
Meet Some More Winners Of Bi-Wizard Coding Contests | GeeksforGeeks
GeeksforGeeks
9 Live Mock DSA
Live Mock DSA
GeeksforGeeks
10 Microsoft Azure For Absolute Beginners
Microsoft Azure For Absolute Beginners
GeeksforGeeks
11 Python for Data Science | Data Science Master Bootcamp | Arpit Jain
Python for Data Science | Data Science Master Bootcamp | Arpit Jain
GeeksforGeeks
12 Getting Started with Data Analysis | Data Science Master Bootcamp | Ashish Jangra
Getting Started with Data Analysis | Data Science Master Bootcamp | Ashish Jangra
GeeksforGeeks
13 How to prepare theory subjects for SDE interviews | Geeks Summer Carnival 2022
How to prepare theory subjects for SDE interviews | Geeks Summer Carnival 2022
GeeksforGeeks
14 Get Your Tickets To The Geeks Summer Carnival | GeeksforGeeks
Get Your Tickets To The Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
15 TED Talk Data Analysis Project | Data Science Master Bootcamp | Ashish Jangra
TED Talk Data Analysis Project | Data Science Master Bootcamp | Ashish Jangra
GeeksforGeeks
16 How I Secured AIR 9 in GATE'22 |  Tushar
How I Secured AIR 9 in GATE'22 | Tushar
GeeksforGeeks
17 Learn Java Backend Development | Geeks Summer Carnival | GeeksforGeeks
Learn Java Backend Development | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
18 How to Recognize which Data Structure to use in a question | Geeks Summer Carnival | GeeksforGeeks
How to Recognize which Data Structure to use in a question | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
19 Learn Data Structures and Algorithms | GeeksforGeeks
Learn Data Structures and Algorithms | GeeksforGeeks
GeeksforGeeks
20 Interview experience at Flipkart | GeeksforGeeks
Interview experience at Flipkart | GeeksforGeeks
GeeksforGeeks
21 Lets Prepare for GATE'23 the Right Way | Sakshi Singhal | GeekSummerCarnival
Lets Prepare for GATE'23 the Right Way | Sakshi Singhal | GeekSummerCarnival
GeeksforGeeks
22 Highest Paying Jobs in 2022 | Ishan Sharma | Geeks Summer Carnival 2022 | GeeksforGeeks
Highest Paying Jobs in 2022 | Ishan Sharma | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
23 Geeks Summer Carnival 2022 | 5th April- 11th April | GeeksforGeeks
Geeks Summer Carnival 2022 | 5th April- 11th April | GeeksforGeeks
GeeksforGeeks
24 Preparing for SDE interviews | Soham Mukherjee | Geeks Summer Carnival 2022 | GeeksforGeeks
Preparing for SDE interviews | Soham Mukherjee | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
25 Full Stack Development with React & Node | Utkarsh Malik | Geeks Summer Carnival | GeeksforGeeks
Full Stack Development with React & Node | Utkarsh Malik | Geeks Summer Carnival | GeeksforGeeks
GeeksforGeeks
26 Introduction to Open Source and Roadmap to GSOC 2022 | Geeks Summer Carnival 2022 | GeeksforGeeks
Introduction to Open Source and Roadmap to GSOC 2022 | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
27 Web Scraping in Action | Geeks Summer Carnival 2022 | GeeksforGeeks
Web Scraping in Action | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
28 Getting Hired at BITCS via GfG Job Portal | Get Hired With GeeksforGeeks
Getting Hired at BITCS via GfG Job Portal | Get Hired With GeeksforGeeks
GeeksforGeeks
29 How to build a faster landing Page | Geeks Summer Carnival 2022 | GeeksforGeeks
How to build a faster landing Page | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
30 Geeks Summer Carnival | 5th To 11th April, 2022 | GeeksforGeeks
Geeks Summer Carnival | 5th To 11th April, 2022 | GeeksforGeeks
GeeksforGeeks
31 How to get ideas for Startup | Geeks Summer Carnival 2022 | GeeksforGeeks
How to get ideas for Startup | Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
32 Journey from Tier 3 to JusPay | GeeksforGeeks
Journey from Tier 3 to JusPay | GeeksforGeeks
GeeksforGeeks
33 Geeks Summer Carnival 2022 | GeeksforGeeks
Geeks Summer Carnival 2022 | GeeksforGeeks
GeeksforGeeks
34 Dispelling Myths and Pre conceptions of Programming Languages
Dispelling Myths and Pre conceptions of Programming Languages
GeeksforGeeks
35 Must Do System Design Questions
Must Do System Design Questions
GeeksforGeeks
36 Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival
Understanding Sorting Techniques in an hour | Keerti Purswani | Geeks Summer Carnival
GeeksforGeeks
37 Get Hired at NEC | Job-A-Thon 8
Get Hired at NEC | Job-A-Thon 8
GeeksforGeeks
38 Journey from Tier 3 college to Microsoft | GeeksforGeeks
Journey from Tier 3 college to Microsoft | GeeksforGeeks
GeeksforGeeks
39 Get Hired with GeeksforGeeks at SuperK | Job A Thon 8
Get Hired with GeeksforGeeks at SuperK | Job A Thon 8
GeeksforGeeks
40 GeeksforGeeks: Redesigned
GeeksforGeeks: Redesigned
GeeksforGeeks
41 From Tier 3 to cracking multiple interviews | GeeksforGeeks
From Tier 3 to cracking multiple interviews | GeeksforGeeks
GeeksforGeeks
42 Live Mock DSA
Live Mock DSA
GeeksforGeeks
43 Youtube Data Analysis | Ashish Jangra | GeeksforGeeks
Youtube Data Analysis | Ashish Jangra | GeeksforGeeks
GeeksforGeeks
44 DSA Self-Paced Course Preview | Sandeep Jain | GeeksforGeeks
DSA Self-Paced Course Preview | Sandeep Jain | GeeksforGeeks
GeeksforGeeks
45 GATE Live Classes | Prepare for GATE CS 2023 | GeeksforGeeks
GATE Live Classes | Prepare for GATE CS 2023 | GeeksforGeeks
GeeksforGeeks
46 Journey from JIIT to Adobe
Journey from JIIT to Adobe
GeeksforGeeks
47 Life Is Unfair Ft. Shonty badmash | LIVE Discord Session | A GeeksforGeeks Exclusive
Life Is Unfair Ft. Shonty badmash | LIVE Discord Session | A GeeksforGeeks Exclusive
GeeksforGeeks
48 Interview Experience at Google | Tech Dose
Interview Experience at Google | Tech Dose
GeeksforGeeks
49 Live Mock DSA
Live Mock DSA
GeeksforGeeks
50 Interview Experience @ Amazon | GeeksforGeeks
Interview Experience @ Amazon | GeeksforGeeks
GeeksforGeeks
51 My journey through the tech world from India to US | Vidushi | GeeksforGeeks
My journey through the tech world from India to US | Vidushi | GeeksforGeeks
GeeksforGeeks
52 Complete Interview Preparation Course | GeeksforGeeks
Complete Interview Preparation Course | GeeksforGeeks
GeeksforGeeks
53 Live Mock DSA
Live Mock DSA
GeeksforGeeks
54 Getting Hired at FiftyFive Technologies | Job-a-thon 9.0
Getting Hired at FiftyFive Technologies | Job-a-thon 9.0
GeeksforGeeks
55 GFG Karlo, Ho Jayega | GeeksforGeeks ft. Khaleel Ahmed
GFG Karlo, Ho Jayega | GeeksforGeeks ft. Khaleel Ahmed
GeeksforGeeks
56 How I got job offers from 2 big companies : Arcesium & Microsoft | GeeksforGeeks
How I got job offers from 2 big companies : Arcesium & Microsoft | GeeksforGeeks
GeeksforGeeks
57 LINUX for Beginners | GFG x Itversity
LINUX for Beginners | GFG x Itversity
GeeksforGeeks
58 My interview experience at Walmart | GeeksforGeeks
My interview experience at Walmart | GeeksforGeeks
GeeksforGeeks
59 Get Hired at Speckyfox
Get Hired at Speckyfox
GeeksforGeeks
60 Live Mock DSA
Live Mock DSA
GeeksforGeeks

Related Reads

Up next
AWS, Azure, GCP: The One Thing Every Business Gets Wrong
AI Daily
Watch →