1:21
2022-10-26 10:40:47
48:29
2022-10-26 11:22:27
1:32
2022-10-26 14:03:58
22:02
2022-10-26 14:09:12
18:32
2022-10-26 14:38:39
1:26:59
2022-10-27 09:43:27
2:08:07
2022-10-27 13:00:05
5:19
2022-10-28 09:57:45
Visit the Certified Kubernetes Administrator Exam Preparation course recordings page
United Arab Emirates - Certified Kubernetes Administrator (CKA) - exam preparation
WEBVTT--> Last four minutes to complete this activity. --> Last four minutes to complete this activity. --> Last four minutes to complete this activity. --> Last four minutes to complete this activity. --> Alright its time up for this activity. --> Alright its time up for this activity. --> Any challenges or questions or do you need additional time please feel free to let me know. --> Yeah I request someone to speak out right because we have this network issue. --> It's all clear all okay shall we proceed? --> Okay thank you so much Shahid. --> Okay. --> Yes please yeah Jason can be Jason and we have option as and why you can look at the documentation. --> Why it means it won't print anything but it will show some additional columns. --> But from the type perspective generally most 90 percent let's say we go with the YAML format. --> But there are here and there there are some organizations that are using Jason for all the specifications of their applications. --> But that is very rare alright. --> So the next topic that we are going to discuss is which means now we have a clarity for every microservices. --> Let's see let me zoom this in a bit okay. --> So for every microservice M1 you are going to create a deployment. --> That's going to get a replica set. --> It's going to create the parts. --> Let's say if you set it as 5 for M1 microservice you have you will have five instances running in your cluster. --> For M2 microservices you are going to create a deployment. --> That's going to get a replica set. --> Maybe you set one instance so one one part will be running. --> And for M3 you have a deployment. --> That's going to get a replica set because you specified your SN3 three parts will be running here. --> So similarly multiple deployments will be running in the cluster which are created by multiple teams that are running all in your cluster. --> So question number one is if you delete this part then immediately this replica set is creating and replacement. --> If you delete this part then this replica set is reacting to it. --> So in the cluster you have three replica set how this replica set identifies their children's or child's or the one that it is created by it. --> If I delete this how this knows that the one that it is missing is the one that is created by it earlier. --> So it's creating and replacement these two replica sets are not reacting to it. --> The same goes for deployment also how deployment identifies the replica sets that it owns. --> Or it manages one thing that was very obvious is as someone already mentioned it can be through a name because it has the name that starts with the deployment name all the part name starts with the replica set name. --> But for that also I mentioned that we don't have any logic here based on names. --> How it works is it works by one kubernetes resource called labels labels is one another kubernetes resource. --> So when we created a deployment we created a deployment called my engine next correct. --> That's all we didn't we didn't give any other input. --> We gave the image name and we give the name for the deployment. --> So we didn't specify any labels explicitly. --> So if because you haven't specified any labels explicitly kubernetes assign some label implicitly, --> which means let's say app equals the default label that applied it can be something like app equals the name that you gave my engine next. --> This is the this is the label on the deployment and this deployment is creating a replica set, --> right and this deployment will put this label on it assign this label on this replica set app equals my engine next in addition to this label on one single resource. --> You can assign as many labels as you want in addition to this label kubernetes will also assign one label that will carry the unique idea of this replica set. --> For example, pod template hash equals that unique idea of the random long unique idea of this object or this resource. --> So two labels will be on on the replica set the label that that assigned by deployment that label that kubernetes assigned it after creating this replica set because only after creating you will get an ID for it. --> And then this replica set created the three parts and if you look at the parts all the three parts will have these two labels. --> Because replica set will create the part and then it will assign these two labels on it. --> Okay, so if I go back here and if I do kubectl get all get all with show labels just for and quicker view. --> I'm just reading all the resources because I have only this deployment for now. --> So I just put show labels flag you can do get deploy name of the deploy and show labels show labels will show an additional column that will have the label information. --> You can also describe any specific resource and you can view the label. --> But if you want to have a quick view you can do show labels look start from the deployment first. --> This is the top level resource and as you can see it has the app equals my engine X label and this deployment created this replica set and it has app equals my engine X label and then for template hash equal the unique idea of the replica set itself. --> Okay, and if you look at the part created by the replica set it all has its label on it. --> Okay, so this is just part one of the story how kubernetes is assigning label on the resources part two is how this label is going to be utilized by the kubernetes. --> Assigning labels is just the first half of the story second second half is how this labels are going to be utilized by kubernetes. --> As selectors label selectors, which means in your infrastructure you have five six ten parts of that ten parts from different different applications. --> If you simply do cube CTL get parts, then all the ten parts will be written. --> Am I right because it's going to turn all the parts. --> So here I can use some kind of filtering logic and I can say if an FN selector equals key value app equals my engine X which means this is going to get the parts that has the label app equals my engine X. --> So maybe out of ten only five will match to it because only those five parts has the label maybe this five part has that label that will be returned here. --> Okay, so using the labels in the selector query that is the second part of the story as any the labels and using the labels. --> Let's say if I go back here even you can assign your own label. --> Let's say I'm going to label this part. --> Let me pick this part. --> You can label any resource not only part deployment replica set node any kubernetes resource. --> You can label cube CTL label. --> I think it will be helpful if I zoom this in a bit. --> Okay, keep sitting label. --> I am going to label a part. --> Name of the part and then the key value. --> Let's say ENV equals broad. --> Okay, it takes me to put it in this format. --> Okay, I copied the entire thing right? --> So I don't need to repeat it either. --> It can be part slash or part. --> All right, it label. --> So if I do cube CTL same command show labels. --> You can see that this part now has a label ENV equals broad. --> So if I do simply cube CTL get parts, it's going to return all the parts. --> I have only five parts. --> I can just simply do selector query. --> And I can specify get the part that has this label with this value. --> There are many many many many things that you can do only the key or multiple values. --> There are many combinations that you there are many operators that we have in operator not in operator and so on. --> Right, but let's keep it simple for now. --> So you can see here only one and one entries return because that's the one that has this label. --> Okay, so assigning a label and using the label as a label selector. --> Fine, but how this is related to the discussion that we are having here. --> How the top level resources are going to identify the child level resource. --> Let me give you an example. --> You created a deployment that created a replica set and it internally created the set of parts five parts. --> And all the five parts has the label happy equals my engine next and pod hash template as an 1 a b 3. --> So blah blah blah blah blah. --> I mentioned that replica set is doing CS equals DS job. --> Current state measures the desired state job in an infinite loop. --> So what I mean by that are what it actually does is. --> Cube CTL get parts hyphen hyphen selector. --> Let's say by this label app equals engine next my engine next and then pod hash template equal to 1 a b c t a. --> So what it does is actually the executes this query in the cluster. --> And this query is going to return some results. --> Right? What is the count of the result? --> Why that is the current state if you delete this the next moment replica set executes this query to this query only four results will be written. --> So current set is for the same set is five. --> So it will spin up a new part and for the new part it will assign this label. --> So the next moment when it runs for this query five will match current set will matches to the desired state. --> So this is the same exact query replica set is using to do its reconciliation loop logic. --> Infinite reconciliation loop logic. --> Okay, and apart from the label these two objects are no way related it blindly blindly works by label. --> The same goes for the relationship between deployment and replica set. --> It's totally loosely coupled. --> I can give you an example. --> If you carefully listen this you can try while I give some time for the hands off. --> Okay, so here I have. --> Cube CTL get parts. --> I have these five parts running. --> And all the five parts has those labels. --> Am I right? --> I can I can show. --> The labels I miss the labels apologies for that. --> So here. --> These are all the labels that are there in the part. --> What I'm going to do is I'm going to remove this label from one of the part. --> I'm going to remove this label then what will happen? --> Obviously when the next time when Cuban replica set queries only these four parts will match --> because that's the one that has this label correct --> because I'm going to not delete the part just remove the label only if I remove this label, --> then this part will no longer be considered by the replica set. --> Because when the next time it executes the cubes it will get parts. --> I find FN sector only this four will match and it will think --> that current set is for and it will create a new part. --> And from that from not from that moment on this part will no longer be considered. --> It will become an orphan part, which means we successfully quarantine this part. --> Let me show you that in action, right? --> Cube CTL. --> The one that we are going to do is DJ 8 by 8 keep that in mind. --> Cube CTL label. --> Cube CTL label. --> I'm going to label a part the name of the part. --> I want to remove this label to remove a label the same command. --> You need to just put key minus key minus will remove the entire label on it from the resource. --> Okay, and label the same way. --> I'm going to remove the other label also other label is part template hash. --> Part template hash because I misspelled it. --> Come on, I just labeled it. --> What happened? --> Okay, it's already a label. --> So if I do Cube CTL get parts. --> Show labels. --> See this label will remove and you can see there is already a part created 69 seconds ago. --> This is the one that got created because after removing the label the current set became four. --> So it's been up a new point and it as in the labels on it. --> You can see we have six parts now. --> So if you delete this part nothing will happen. --> Because this is already an orphan part standalone part or fat. --> Okay, so it purely works by the label and again, --> if you label let's say while you are trying the hands-on try to assign these two label on this sixth part. --> Then the next moment when it queries all the six part will match to the sector label. --> Cube CTL get part selected then all six part will match. --> Which means current state is six desired state is five. --> So it will remove randomly one of the pocket. --> So in this case it is the same application. --> Even if you are going to run a standalone Postgres database --> and assign the same label here on the Postgres database, --> it may delete one of the one of the existing component or the Postgres component. --> It won't even see whether it is of the same family or not. --> It just blindly works by the labels on it, --> which means if you are if you are asserting some label here --> and if the replica set adopts this which means you successfully adopted and thought --> so quarantining or adopting both you can achieve with the help of the labels. --> I don't think in production you will be doing that --> but the reason why I explain this is how this we are saying --> we are talking about this hierarchy literally --> this hierarchy is completely loosely couple --> and it works only by the labels and labels as such --> the concept is pretty simple isn't it? --> You are going to assign some key value para and resource --> how to label using Cube CTL label command --> how to unlabel using Cube CTL label command --> how to use the label in the selector query --> how kubernetes resource like replica set uses label selector in its reconciliation loop --> and a simple demo on quarantining or adapting a part by labeling or unlabeling from it. --> That's all we discussed. --> I'm going to give a quick pause here for you to try this command --> and let me know for any questions. --> I will share this commands in the etherpad --> and if you confirmations please if it is clear good to try. --> Let me put it here this commands here. --> Thanks for that confirmation by the way. --> Okay, so labeling and labeling using label in the selector adopting quarantine. --> So this concept we discussed here. --> So at least let's take some five minutes at least to try this and explore the labels and try to assign an unlabel. --> So please spend some time on the hands-on because on the day two or day three, --> I will be giving a lot of exercises with scenarios. --> So I'm sure you will be able to crack all the scenarios that I provide. --> But what is more important from an examination perspective is timing. --> You will be really having a limited time. --> So you need to be really have fast hands while doing the samples, right? --> So if you try more during this hands-on time, --> then it will be simpler during the system or else we will take a lot of time just to solve one single. --> Use case. --> Okay. --> Yep, let's take some five to ten minutes. --> Not more than that to try the labels, please. --> Thanks for choice.