Mock Test - 1, CKAD Prep Exam

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome to this video in today's video basically i plan to solve mock exams for ckad and one of the resource that i've been using for my preparation is this course on and it comes with four practice exams so two full length exams which are one hour long and then you have two lightning labs which are 30 minutes long so in this video i will start with mock exam one and in the future videos i do plan to cover mock exam two as well as lightning labs okay so let's start solving the exercises my environment is ready now i'll click on quiz portal i have one tab open just like in exam you're allowed to keep one tab open for referring to the documentation so i'll be practicing in a similar way so the first question is to deploy a port named nginx 448839 using nginx alpine image so for this question i will be using an imperative command to generate this resource and it's one of the easiest questions so far and the reason why i'm adding this flag restart never is so that we only generate a pod and not a deployment so if i don't include this flag it will go ahead and spin up a deployment technically even that would be correct because uh that will spin up the pod itself uh but in this case since the question asks you for a pod it's better to just do that and as you can see part is created successfully so now let's move on to the next question create a namespace called apx z993845 so k create and this is the short form for namespace next create a new deployment named http front-end with three replicas using image okay so for this one i will be using imperative command but i will use hybrid approach so what that means is i will generate a deployment definition file from the imperative command and then i will just change the number of replicas that we need because in this new version of cubectl this cubectl create command does not provide an option or argument for specifying the number of replicas so k create deploy deploys the shorthand for deployment and the image let me copy the image from here and using dry run i will just output this object and then copy it in this file which i'll name it as deploy.tml now as you can see there is replicas so [Music] i'll go to that line and then basically change the number to three so that is the only requirement here create f deploy.tml and that is done so the next question is deploy a messaging pod using redis alpine image with labels set to tier equal to message so we can achieve all of that using imperative command there's no need to generate the file [Music] so the thing is when you specify uh this flag labels it automatically assumes that it's a part and not a deployment and that's why you don't really need to add the the flag restart equal to never and as you can see this part is created if i want to confirm it i will do i'll describe this part and as you can see we have added the labels successfully so now let's move on to the next question a replica set rsd 33393 is created however the pods are not coming up identify and fix the issue okay so now i can see here it's invalid image name so i can already guess from this that the image name is wrong and when the kubernetes is trying to pull this image from docker hub it's not able to find it so anyways let's inspect rs is the shorthand for replica set so let me just copy this name and what we will do is uh we'll generate a yaml file from this resource that is already running in the cluster i'll find the image and as you can see here i can already guess those uh capital x's they are like unwanted characters so let's just remove those and now let us just save so for replica set you cannot edit when the resource is already deployed it does not you cannot update any properties so in this case we will have to delete all of the pods that are running and so the new ones that will come up um will have this change included uh but for now what i will do is i will go ahead and delete the replica set itself so that will kill all of the pods and then i will just create fresh from this file okay so just to confirm now uh let us check so i can already see the two of them are running so i mean there's no error so we can move on to the next question create a service messaging service to expose redis deployment in the marketing name space within the cluster on the port 6379 use imperative command so here it specifically asks you to use imperative command and i think that's also one of the easiest one to use like it's faster for the exam um and you just go to the reference docs here on the left hand side you'll see expose click on that and then you'll find the command itself over here what i find useful is to look at the examples on the right hand side rather than trying to make sense of all of these optional parameters or flags that you can pass so in this case since we need to expose the deployment i will copy this and the deployment name is redis and the name of the service is messaging service on the port 6379 so this is for the marketing namespace and then the name of the service itself messaging service okay so now we are good we can move on to the next question update the environment variable on the pod web app color to use screen background so again in this case um we cannot just update the environment variable when the pod is already running so to update it we need to first kill the pod and then uh create a new pod with the updated values um but since we are not provided with the yaml files what i'll have to do is basically generate it from the object that is running here so the command for that is um get the pod web app color and output it in yaml format and then copy that syntax into our file so this will be web dot yam and i'll search for the environment variable here okay so you can see there's a pink will just replace it with green now first i'll have to delete the already running pod so the reason i'm adding these flags grace period equal to zero and force is because i want the part to be killed immediately and we don't want to wait for the pod to kill gracefully because we don't have that much time during the exam so this is quite handy okay i forgot to add the resource pod and as you can see it's killed immediately and now we can use that file to generate a new part with the environment the next question create a new config map name cm 3392845 use the spec given on the right so here it doesn't mention that whether we should use imperative or declarative style of command but in this case i think going with the imperative one will be much faster so on the left hand side once again you'll see create and under create this config map let's go to that and i will be using the from literal thing so i'll just copy till here copy the name of the config map and then add these specifications or data the only problem is you have to keep repeating this from little all the time but i think it's still faster compared to the declarative way of doing things okay so that is generated let's move on to the next question create okay i think there's some mistake it's the same question here create a new secret name db secret xxdf with the data given on the right so what i'll do is i once again i will use a similar command to generate the secret um refer to the documentation here secret generic and just notice one thing if you copy from your cube ctl create generic this will lead to an error and i've faced this issue personally many times because you have to include the keyword secret as you can see here this is the correct version i don't know if this is a typo or or if there is some purpose behind leaving that out that's why i find these examples to be more intuitive so in this case i will just add this statement i'll copy it from here and copy the name [Music] and basically it's the same drill from here on from little db host once again from little db user root db password password one two password123 okay so that is created successfully let's move on to the next question update the pod appsec to run as a root user with system capability so let me go back to the docs check for capability and you will find this under security context so let me search for the word system and these are the exact three lines that we need to copy let's copy that okay so first of all uh because this part is already deployed we need to create the yaml file from it and then we will go in and edit the capabilities so let's do that k get full absec oh yemen and set.html vi dot html and to go to image so right about here i will add those three lines [Music] copy them it's at the same indentation level as the image okay now [Music] i'll go ahead and delete net admin once again i will have to delete the the this part first and then recreate it so we'll add grace period equal to zero force and kill it okay so the pod is created successfully let's move on export the logs of ecom this pod ecom1123 to the file at this path and it is in a different name space so identify the name space first so i'll have to do all name spaces and look for that one ecom1123 it is in e-commerce namespace so so right off the bat what i will do is i will just set this namespace to i'll pass on this flag so that i don't forget it later on and e-commerce logs and then the copy the name of this pod and basically we'll copy all of the output from this command into the file on this path so let's copy that paste it and to confirm i will just cat it out so as you can see we have all the logs copied in that file so we're good let's go to the next question create a persistent volume with the given specification so persistent volume and okay so here it is and what all uh properties i need to add volume name storage access modes and then the host path so from this i need only till access modes because rest of the things i don't need to specify now let's go ahead and edit this file so first the name name has to be pv [Music] analytics storage 100 ml okay and rewrite many and the next one is host path at this part so this one we have to add manually okay so let's go ahead and create it pvp.tml and that is created let's go to the next one create a redis deployment using this image redis alpine with one replica and labeled app reduce and then expose it via cluster ip service called redis on port 6379 after that we also need to create a new resource or new network policy and that will allow any incoming traffic from [Music] from the pods that have this label access redis okay so in a single file first i'll create a deployment and service and then we will look at the network policy so for this one um once again i will use the hybrid approach to first generate the file [Music] deploy red is our time and let's name it as dp dot yaml open this file dp.tml and image already there one replica and the label is already app reduced so we don't need to change anything here let's just create the service to be exposed on this port 6379 so i'll copy the definition for service and we want the most basic one so let's just copy this one so we can create two definitions within one file just by adding these three dashes or three hyphens between the two definitions and it's treated like two different files so the name of the service the name of the service is redis so first i'll search for it change it to redis and i'll also have to change the selector to match to the deployment and then the port should be 6379 so and i'll just remove the target board it's not mandatory because if you specify the port uh the target port is considered to be the same as the original port so i think we are good here let's create these resources as you can see we have both deployment and service created so now we have to create a network policy so let's go to the network policy definition and let's copy it till here because we need to specify the ingress traffic okay and now i'll just edit that file np dot gml so the name of this network policy is supposed to be redis access okay and only the pods okay so so in the selector first we'll have to match it to the kind of part of the deployment that we are trying to give access to so that is app fred is as we already defined over there and now we have to define some of the policies for ingress some specifications okay so there's a lot of unwanted data like we don't really need this namespace selector ip block so i'm just going to go ahead and remove those and now under pod selector we need to specify the labels to match to this one so that will be access redis and the ports are already correct 6379 so no need to change that and now let's create it okay so that is created let's go to the next question this is the last question in the lot create a pod called sega with two containers the first one name is tails and the image is busy box and we need to provide the command sleep3600 and then there's a container 2 with the specification so i will first generate using the imperative command i'll generate a port definition file and then we will add the additional containers so the name is sega image is busy box and restart equal to never try run equal to client o i will name this file as multi dot here okay so first thing if you see the name of this container it has given sega that is by default we don't want that so let's change it according to the question we need to make it tails as you can see here and then there's a command sleep 3600 so let me remove all of the additional lines which we don't need okay and now we will set up the next container so first i'll copy all of the lines from this one and the image for this one is nginx and the name is sonic we don't really need command here but we have to pass environment variables environment variables are an array so we have to give it a dash name name will be engine export and then the value will be eight zero eight zero so okay create dash f multi dot gml and that is created just to confirm that all the containers are running so as you can see there are two containers and it's still in the creating stage let's make sure that there's no problem before we end the exam so as you can see now it is running and we are good to go so let's go ahead and end the exam this is optional fingers crossed let's hope we get hundred percent awesome thank you so much for watching this video
Info
Channel: The FrontOps Guy
Views: 13,768
Rating: undefined out of 5
Keywords: CKAD, Kubernetes, Certified Kubernetes Application Developer, Mock Exam
Id: TPXwVmvzlV4
Channel Id: undefined
Length: 35min 43sec (2143 seconds)
Published: Mon Jul 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.