Deploy on Kubernetes Using Git, Jenkins, Ansible | Simple DevOps Project -5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome back to my last two hands-on video session in this video I am going to show you how to set up kubernetes under deploying a kubernetes using Jenkins and ansible in a single video it would be useful for you to refer once again once you completed your course to do this I will go through with all our github resources which we use in our training so that we can set it up quickly if you wish to watch entire series of these videos you can enroll for this course in udemy I have given this link in the description of this video as you have seen I have explained how to set up kubernetes and deploy on kubernetes in our previous videos in this lecture I will just quickly run through with other all the steps I may not explain each and everything clearly with that let's jump into our github repository so I'm on my github repository simple devops project here we have a kubernetes folder under that we have kubernetes set up dot MD which is having steps to set up kubernetes in this case first we should set up an Ubuntu ec2 instance I have already logged into my AWS management console let us go to ec2 instances we don't have anything so I have stopped all our DevOps environment let's launch an instance it is whooping - Tito micro would be sufficient nothing to change here a GP would be fine tag name kids management server because we are managing our kubernetes using this select existing security group and launch keypair devops project keeper i'm using will wait until it comes up and refreshing my console yes it's running let's take the IP address open MOBA Ekstrom session ssh IP address followed by our private key and it is Ubuntu system so user is Ubuntu and let me increase the font size now let's become your route clear the screen so next step install your WIC Li for that first let's download AWS CLI bundle now we should unzip I think unzip is not there in Google to system so apt-get our apt install unzip and python even python also we need yes I want to install it next on jeepers the WSDL a bundle next install it so we have set up there wh CLE AWS - - Porsche yes it is installed next we should install Cube CDL to install cube CTL first to download it then next command would be our execution permission to this you can just see that file yes this is the file there is no execution permission so let's add it next thing we should move it into /usr local bin that's it now tube CTL yes cube serial version 1.15 we have installed this is the latest version right next we should install cops cops is a tool which is useful to set up kubernetes cluster on AWS without this we cannot able to talk with our AWS management console so we must need it so once it is downloaded even we show there our execution permission to this okay I had execution permission okay this is the one now move it into us our local Dean it's done we should create I am user our role with the route 53 ec2 I am and s3 full access let's go to AWS console services I am roles because our abundance is tamal so sitting in AWS so roles would be sufficient and we are attaching this role to ec2 next to add permission we need to add easy to full access next yes threefold axis next route 53 full access then ie am full axis name k-8 roll Cal slow cubes the role and you can see here easy to use three route 53 I am full access we have granted create a role once role is created we should attach this role to over ec2 instance let's go back to again on ec2 instance console and here we have K it's management system actions instance settings attach our replace iron ball okay let's roll apply it that's it we have done now now we need to tell to this kubernetes management system to create servers only unknown by region for that we should run we have the previous configure we don't have access key ID and secret access key because it is a role and the default region the Epis South one this is Mumbai region name and output let it be default that's it now I will just execute their WS s 3 LS just to make sure that our role is working yes we can access s 3 and this is the bucket which is already exist let it be we are going to store our configuration in this bucket I will go and make it empty so again services just 3 new tab go to s 3 I will just empty so that we don't have any data in this bucket confirm all right next attach an I am vote yes it's done under rank duration now create a route 53 private hostage on yes let's do that now again go to services and it comes under networking route 53 so this is route 53 DNS management of get started now create create hostage on relaxy dotnet I'm giving and it is a private hostage on if it is publicly accessible then we can use the public hostage on now let's go to Mumbai region this is the region we are using and create it so we have created a hostile Jones for galaxy dotnet let's go back again now we should create an s3 bucket this is the commander to create from give our kubernetes management console but anyway we have already this bucket now we export this bucket so that cops can able to store the configurations in this bucket so I we have exported now generate a key pair this key pair is useful to log into our kubernetes cluster without creating this we cannot able to create cluster now this is the commander to create a cluster that is create cluster in here ws cloud available to each one AP South one be next kubernetes cluster name dns zone name under dns dns is a private so it creates only definitions and stores in our s3 bucket I will just show you go to inside to bucket again inside so these are the configurations which just you are created your August 24th 640 ok now it has been created and if you want to modify your cluster there is a edit commands under to set up our cluster we shall be execute this command but before doing that one I will just make sure that we are going to launch smaller instances otherwise it is going to launch bigger instances so master instance aren't going to launch it as jt2 small so to change your master node capacity we need to edit this configuration file and here you can see see for large we really don't need see for large so I am going with t2 all right other configurations if you wish to change you can change it here to set up our cluster actually we should execute this command and it takes five to ten minutes once it is successful we can validate our cluster and it also displays the commands which is required to execute after setting up your cluster just let's see that so see here to validate cluster this is the command to list nodes cube CTL gate notes so levels to associates this is the command with admin user we should login and this is the URL which is going to create in our DNS we'll wait five to ten minutes to validate our cluster then we'll jump into our master node I will just to show you this is route 53 under route 53 record sets we can see addition only for record sets has been created under ec2 we will get the three more nodes master is T 2 micro under nodes RT 2 medium because we haven't changed the nodes let's wait until our cluster comes up it takes 5 to 10 minutes I am just pausing this video so let's validate our cluster still it is creating let's wait let me command again yes our cluster II study now to login to our cluster we have a command that is SSH and key followed by admin user on to our cluster yes I want to login okay I have locked into my kubernetes master node become a root clear the screen if I run cube CTL version here you can see it is running with version 1.1 - we want to upgrade this one to the latest cube CTL version for that again we can follow the same documentation what we use to install on Ubuntu system this is the one to install cube CTL what is going to download then we should change the permission and move it into us our local bean now if I execute same command this time we could see the latest version right now we should copy the deployment and service files which are available in our github repository here is our github let's go back on to kubernetes here we have relaxi deploy and relax ii service let's open this copy this file name cat greater than copy this content and if you see here it is going to create a deployment that is well exceed deployment with two replicas and rolling update and it pulls the image and it is always pulls the latest image in terminal it runs on port number eight zero zero similar way we should copy service file this is our service file don't copy this another thing if you see here we are creating relaxi service and also app name we are giving as a velocity Bob's project and it is a load balancer type internally runs on port number eight zero zero expose on port number eight zero eight zero externally accessible from three one two double zero next we need to create ansible playbooks for that I am going to bring the power ansible server currently in stop state let me start it refresh it okay it is running take the IP address session SSH IP address of Huntsville server key paid and it is Amazon Linux so easy to - user and change the display settings terminal settings background I'm going to use the Solarize the dark okay we have logged in let me increase the font size and become here in a sudden that's it clear the screen now we want to enable password less authentication between ansible to our kubernetes master node for that we should copy our key pair onto dot ssh authorized location of this server for that let me go to dot ACH here we have our D underscore RS a dot pub this is your public key let's add this public key into authorized hosts in the kubernetes master so on the route there's a Shh let me cut authorizer keys no double greater-than authorizer keys I'm just appending my key over here that's it clay up the screen now let me test the password less authentication between these two there's a Shh - I already under square RS CA IP address of this system let me take the public IP because both are in different V pcs we cannot connect with private IP addresses and we should log in as the root user right the root art IP address yes I want to connect and you can see here you have locked into 60 1.2 31 which is the cluster IP right so password less authentication is enabled now we should create ansible playbooks for that lets go to opt LS let's create a separator directory mkdir okay it's lab so this is the sorry we should do with the sudo we have created the carrots lab and we should give the permission to this one too ans admin CH sudo CH own in a submarine followed by an acid mean unque claps and let me do it with recursive alright now we have set up whatever is required let's go inside to clear its lab and we should create playbooks to create image and execute our deployment and services for that it is already updated in our github repository and go back to Cooper naty's again oops something is missing let's go / I think we haven't copied it properly into the file so let's go back suited or dot LS cannot relax the service okay it is not covered properly so can't greater than Biloxi services again I'm doing it this time equally coupled it let me check that deployment also scarpered properly that's it now yep go back kubernetes to create a image this is the ansible playbook we should copy let's copy this one and also we have to create a hosts file we'll create after creating this playbook take it anonymous will server okay let me take the filename because we are going to give the same file name in our Jenkins job then followed by our playbook all right so ansible server it is going to look for this server for that we can create a inventory file over here va hosts and ansible server here we are going to do localhost and also kubernetes now we are going to do the kubernetes IP address over here that is available here that's it now this is the file we have created image now image we are going to create under jackets lab so this is the location we are creating image it pushes image on to my angle docker hub so nothing to change it let it be now we need to copy two more files those are executing deployment file this is the playbook to initiate our deployment and copy this next service it initiates our service cannot greatly down and service even you can use VA that's not your problem but we have already created these files nothing to write it so immediately I'm copying by using cat greater than that's all whatever is required we have copied hosts file disk set up and all are wound by NS admin make sure that permissions are given to NS admin and yeah docker file we need to copy it is also available over here so darker fur we'll be a docker file insert more and copy this that's it we have set up all the stuff whatever is required your last minute cell okay everything is fine now now let's go to our Jenkins server and create a job our Jenkins server is down right now let me bring it up okay our Jenkins ro is up right now take the public IP 0h0 admin and password so new job about 90 job Marvin okay under let me get the repository URL for the world copied so we are creating darker image we just create a darker image with this job select get get URL and the credentials are not near because it is a public one poll SEM so the terminated is going to run clean install clean install package to build no post build actions send build artifacts over SSH it should be from ansible server and it is available under web dap slash target slash dot dot wear and remove the prefix Web Apps last target we are going to remove remote directly /opt Kate's lab this is the one right but we should q double slashes let me increase the font size so double slashes scares lab next to create image we should run ansible playbook and simple playbook manaphy opt slice carrots lab slash hosts followed by our playbook name slash Wapiti k-8 lab slash our playbook means create simple develops image that's it it is going to create an image under this location apply save now we should create a CD job go back new item kubernetes CD job it is freestyle it is not marvin job creating opportunities deployment because we ought to deploy nothing to build over here we just need to do the post build actions and it should happen on unspell server nothing to copy over here we just need to execute commands and Sybil playbook - i /warp it is class kids lab / hosts /opt / kids lab / our playbook name so let's get the deployment file this is our deployment file and with semicolon then one more job same command let's copy it and this time it is not a deployment it is service file let me take the service file this is the service file alright we set up all the stuff which is required to execute this command and we need to add this silly job in our CIA job go here okay this is initially runway because we have enabled policy M configure now under post build actions build other projects so scroll up here we should choose our kubernetes CD job apply and we want to run it if the CA job is stable say that's yet we have set up everything now before executing these jobs let's go back to our cluster and clear the screen cube CTL get parts we don't have any parts deployment we don't have any deployments we don't have any services except a default one right now let's execute the job on C before executing hobknocker calm we're ankles even we can change our we can create new repository if we wish then even on it so this is the one so it's updated three minutes ago because our job ran one one eight commits that's okay now let's execute our job let me initiate our job manually next time we are going to change our code so it is initiated let's open it so it is creating image and pushing your image but success and it initiated Sudi job about to execute yes it's initiated let's open this one as well okay this job also success now we'll see the pores yes we have pores let's created three parts interesting okay yup it is terminating one because only we need to and also services if I see okay one service has been created and expose done three one two double zero let's access it I am going to take kubernetes master Public DNS and 31200 okay we should open this port in the security group level we missed it now let's go open it because by default this port doesn't comes with your security group inbound edit so these are lot of ports which are necessary to run your kubernetes cluster here 31200 we are enabling let's access it from public save it yes this time Tom vacation is accessible webbed up okay everything is fine now to validate this one one more time I'm going to change my code for that let's log into our Jenkins server take the public IP so go to session ssh public IP address the c-terminus user okay become route clear the screen LS here we have hello world the go-to web app SRC main web app here we have index dot JSP I will remove this are you glad to see you here because it is our last session so we get ad dot and git commit - M my final in this repo the git push origin master that's it once it is pushed our Jenkins job has to take care of everything I mean to say my CA C D job should take care of everything let's see yes you can see here Q Burnett is CI job is executing let's open it job number 3 is executing I don't touch anything I want to see my latest application over here okay so it is going to push the images Keltie success next cube city LCD job that is about to execute yes right superb yes glad to see you here alright that is how we can able to achieve our continuous integration and continuous deployment using git Jenkins ansible darker kubernetes hope you enjoyed my session if you face any issues please write to us I will try to answer as soon as possible thank you and happy learning
Info
Channel: Valaxy Technologies
Views: 76,193
Rating: undefined out of 5
Keywords: aws, devops, valaxy technologies, security, automation, simple devops project, Devops project, simple devops project 5, devops project ar shankar, ar shankar valaxy tecnologies, Deploy on Kubernetes cluster, deploy on kubernetes, deploy on kubernetes using git jenkins ansible, integrationg kubernetes on cicd, cicd pipeline for kubernetes, valaxy devops project, ar shankar, kubernetes project, deploy on pods using ansible, jenkins job to deploy on kubernetes, devops kubernetes, k8s
Id: gVjLDwcA6sQ
Channel Id: undefined
Length: 33min 40sec (2020 seconds)
Published: Tue Aug 27 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.