8 videos 📅 2022-10-26 09:00:00 Africa/Blantyre
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

00:00:09.820 --> 00:00:13.060
Last four minutes to complete this activity.

00:00:56.740 --> 00:00:59.660
Last four minutes to complete this activity.

00:01:29.260 --> 00:01:29.700
Last four minutes to complete this activity.

00:01:59.200 --> 00:01:59.720
Last four minutes to complete this activity.

00:02:10.900 --> 00:02:13.260
Alright its time up for this activity.

00:02:13.260 --> 00:02:13.580
Alright its time up for this activity.

00:02:14.340 --> 00:02:20.920
Any challenges or questions or do you need additional time please feel free to let me know.

00:02:28.180 --> 00:02:33.740
Yeah I request someone to speak out right because we have this network issue.

00:02:35.500 --> 00:02:38.020
It's all clear all okay shall we proceed?

00:02:40.120 --> 00:02:42.940
Okay thank you so much Shahid.

00:02:45.000 --> 00:02:45.660
Okay.

00:02:48.640 --> 00:02:55.920
Yes please yeah Jason can be Jason and we have option as and why you can look at the documentation.

00:02:55.920 --> 00:03:01.080
Why it means it won't print anything but it will show some additional columns.

00:03:03.860 --> 00:03:10.560
But from the type perspective generally most 90 percent let's say we go with the YAML format.

00:03:10.560 --> 00:03:18.400
But there are here and there there are some organizations that are using Jason for all the specifications of their applications.

00:03:18.580 --> 00:03:20.220
But that is very rare alright.

00:03:21.180 --> 00:03:28.540
So the next topic that we are going to discuss is which means now we have a clarity for every microservices.

00:03:30.500 --> 00:03:33.120
Let's see let me zoom this in a bit okay.

00:03:33.120 --> 00:03:39.320
So for every microservice M1 you are going to create a deployment.

00:03:40.560 --> 00:03:42.160
That's going to get a replica set.

00:03:42.460 --> 00:03:44.040
It's going to create the parts.

00:03:44.060 --> 00:03:50.380
Let's say if you set it as 5 for M1 microservice you have you will have five instances running in your cluster.

00:03:51.380 --> 00:03:54.080
For M2 microservices you are going to create a deployment.

00:03:55.500 --> 00:03:57.000
That's going to get a replica set.

00:03:57.660 --> 00:04:00.780
Maybe you set one instance so one one part will be running.

00:04:00.780 --> 00:04:03.860
And for M3 you have a deployment.

00:04:04.880 --> 00:04:12.220
That's going to get a replica set because you specified your SN3 three parts will be running here.

00:04:13.560 --> 00:04:22.440
So similarly multiple deployments will be running in the cluster which are created by multiple teams that are running all in your cluster.

00:04:22.980 --> 00:04:32.180
So question number one is if you delete this part then immediately this replica set is creating and replacement.

00:04:33.240 --> 00:04:36.900
If you delete this part then this replica set is reacting to it.

00:04:37.320 --> 00:04:45.780
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.

00:04:46.360 --> 00:04:51.960
If I delete this how this knows that the one that it is missing is the one that is created by it earlier.

00:04:51.960 --> 00:04:56.020
So it's creating and replacement these two replica sets are not reacting to it.

00:04:56.020 --> 00:05:01.820
The same goes for deployment also how deployment identifies the replica sets that it owns.

00:05:02.800 --> 00:05:13.880
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.

00:05:14.200 --> 00:05:18.840
But for that also I mentioned that we don't have any logic here based on names.

00:05:19.720 --> 00:05:28.340
How it works is it works by one kubernetes resource called labels labels is one another kubernetes resource.

00:05:29.580 --> 00:05:36.660
So when we created a deployment we created a deployment called my engine next correct.

00:05:38.400 --> 00:05:41.920
That's all we didn't we didn't give any other input.

00:05:41.920 --> 00:05:44.980
We gave the image name and we give the name for the deployment.

00:05:44.980 --> 00:05:48.340
So we didn't specify any labels explicitly.

00:05:49.720 --> 00:05:56.480
So if because you haven't specified any labels explicitly kubernetes assign some label implicitly,

00:05:57.260 --> 00:06:07.560
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.

00:06:08.220 --> 00:06:13.320
This is the this is the label on the deployment and this deployment is creating a replica set,

00:06:13.320 --> 00:06:25.800
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.

00:06:25.800 --> 00:06:36.720
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.

00:06:36.720 --> 00:06:46.400
For example, pod template hash equals that unique idea of the random long unique idea of this object or this resource.

00:06:47.340 --> 00:06:59.240
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.

00:06:59.240 --> 00:07:07.080
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.

00:07:08.600 --> 00:07:13.180
Because replica set will create the part and then it will assign these two labels on it.

00:07:13.180 --> 00:07:31.200
Okay, so if I go back here and if I do kubectl get all get all with show labels just for and quicker view.

00:07:31.200 --> 00:07:35.120
I'm just reading all the resources because I have only this deployment for now.

00:07:35.120 --> 00:07:46.860
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.

00:07:48.080 --> 00:07:51.500
You can also describe any specific resource and you can view the label.

00:07:51.500 --> 00:07:58.500
But if you want to have a quick view you can do show labels look start from the deployment first.

00:07:58.500 --> 00:08:18.180
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.

00:08:19.860 --> 00:08:26.780
Okay, and if you look at the part created by the replica set it all has its label on it.

00:08:30.260 --> 00:08:44.180
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.

00:08:46.760 --> 00:08:56.440
Assigning labels is just the first half of the story second second half is how this labels are going to be utilized by kubernetes.

00:08:58.760 --> 00:09:14.140
As selectors label selectors, which means in your infrastructure you have five six ten parts of that ten parts from different different applications.

00:09:14.700 --> 00:09:20.520
If you simply do cube CTL get parts, then all the ten parts will be written.

00:09:20.520 --> 00:09:23.760
Am I right because it's going to turn all the parts.

00:09:24.380 --> 00:09:45.900
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.

00:09:46.560 --> 00:09:58.380
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.

00:09:59.180 --> 00:10:09.480
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.

00:10:10.100 --> 00:10:14.060
Let's say if I go back here even you can assign your own label.

00:10:14.080 --> 00:10:16.160
Let's say I'm going to label this part.

00:10:16.440 --> 00:10:17.480
Let me pick this part.

00:10:22.880 --> 00:10:29.660
You can label any resource not only part deployment replica set node any kubernetes resource.

00:10:29.660 --> 00:10:34.900
You can label cube CTL label.

00:10:38.240 --> 00:10:42.080
I think it will be helpful if I zoom this in a bit.

00:10:42.540 --> 00:10:44.140
Okay, keep sitting label.

00:10:44.640 --> 00:10:46.620
I am going to label a part.

00:10:48.160 --> 00:10:50.740
Name of the part and then the key value.

00:10:51.940 --> 00:10:54.200
Let's say ENV equals broad.

00:11:01.320 --> 00:11:04.160
Okay, it takes me to put it in this format.

00:11:04.160 --> 00:11:06.100
Okay, I copied the entire thing right?

00:11:06.260 --> 00:11:08.260
So I don't need to repeat it either.

00:11:08.260 --> 00:11:10.380
It can be part slash or part.

00:11:12.360 --> 00:11:14.320
All right, it label.

00:11:14.540 --> 00:11:19.140
So if I do cube CTL same command show labels.

00:11:21.740 --> 00:11:27.160
You can see that this part now has a label ENV equals broad.

00:11:27.940 --> 00:11:32.320
So if I do simply cube CTL get parts, it's going to return all the parts.

00:11:32.320 --> 00:11:33.740
I have only five parts.

00:11:35.100 --> 00:11:37.100
I can just simply do selector query.

00:11:39.180 --> 00:11:44.240
And I can specify get the part that has this label with this value.

00:11:44.720 --> 00:11:50.200
There are many many many many things that you can do only the key or multiple values.

00:11:50.280 --> 00:11:56.760
There are many combinations that you there are many operators that we have in operator not in operator and so on.

00:11:56.760 --> 00:11:59.380
Right, but let's keep it simple for now.

00:11:59.380 --> 00:12:04.640
So you can see here only one and one entries return because that's the one that has this label.

00:12:06.440 --> 00:12:11.760
Okay, so assigning a label and using the label as a label selector.

00:12:13.340 --> 00:12:17.180
Fine, but how this is related to the discussion that we are having here.

00:12:17.480 --> 00:12:21.040
How the top level resources are going to identify the child level resource.

00:12:21.480 --> 00:12:22.960
Let me give you an example.

00:12:25.480 --> 00:12:32.400
You created a deployment that created a replica set and it internally created the set of parts five parts.

00:12:33.940 --> 00:12:42.360
And all the five parts has the label happy equals my engine next and pod hash template as an 1 a b 3.

00:12:42.620 --> 00:12:44.000
So blah blah blah blah blah.

00:12:45.360 --> 00:12:50.400
I mentioned that replica set is doing CS equals DS job.

00:12:50.400 --> 00:12:55.080
Current state measures the desired state job in an infinite loop.

00:12:55.700 --> 00:13:01.040
So what I mean by that are what it actually does is.

00:13:01.040 --> 00:13:06.400
Cube CTL get parts hyphen hyphen selector.

00:13:07.940 --> 00:13:17.380
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.

00:13:17.380 --> 00:13:21.820
So what it does is actually the executes this query in the cluster.

00:13:23.340 --> 00:13:25.800
And this query is going to return some results.

00:13:26.000 --> 00:13:28.280
Right? What is the count of the result?

00:13:28.580 --> 00:13:37.900
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.

00:13:38.780 --> 00:13:41.720
So current set is for the same set is five.

00:13:42.600 --> 00:13:47.340
So it will spin up a new part and for the new part it will assign this label.

00:13:48.000 --> 00:13:54.140
So the next moment when it runs for this query five will match current set will matches to the desired state.

00:13:54.840 --> 00:14:03.120
So this is the same exact query replica set is using to do its reconciliation loop logic.

00:14:04.720 --> 00:14:06.980
Infinite reconciliation loop logic.

00:14:08.280 --> 00:14:17.780
Okay, and apart from the label these two objects are no way related it blindly blindly works by label.

00:14:18.800 --> 00:14:21.760
The same goes for the relationship between deployment and replica set.

00:14:22.280 --> 00:14:23.680
It's totally loosely coupled.

00:14:24.440 --> 00:14:25.540
I can give you an example.

00:14:25.540 --> 00:14:29.420
If you carefully listen this you can try while I give some time for the hands off.

00:14:30.320 --> 00:14:34.480
Okay, so here I have.

00:14:34.600 --> 00:14:37.280
Cube CTL get parts.

00:14:38.760 --> 00:14:40.500
I have these five parts running.

00:14:41.480 --> 00:14:43.960
And all the five parts has those labels.

00:14:43.960 --> 00:14:44.420
Am I right?

00:14:45.120 --> 00:14:46.200
I can I can show.

00:14:48.900 --> 00:14:52.900
The labels I miss the labels apologies for that.

00:14:52.960 --> 00:14:53.680
So here.

00:14:56.060 --> 00:14:59.060
These are all the labels that are there in the part.

00:14:59.860 --> 00:15:04.680
What I'm going to do is I'm going to remove this label from one of the part.

00:15:06.640 --> 00:15:10.400
I'm going to remove this label then what will happen?

00:15:10.660 --> 00:15:16.620
Obviously when the next time when Cuban replica set queries only these four parts will match

00:15:16.620 --> 00:15:19.420
because that's the one that has this label correct

00:15:20.200 --> 00:15:25.980
because I'm going to not delete the part just remove the label only if I remove this label,

00:15:25.980 --> 00:15:29.160
then this part will no longer be considered by the replica set.

00:15:30.440 --> 00:15:33.560
Because when the next time it executes the cubes it will get parts.

00:15:33.760 --> 00:15:37.960
I find FN sector only this four will match and it will think

00:15:37.960 --> 00:15:41.060
that current set is for and it will create a new part.

00:15:43.020 --> 00:15:47.680
And from that from not from that moment on this part will no longer be considered.

00:15:47.680 --> 00:15:55.460
It will become an orphan part, which means we successfully quarantine this part.

00:15:55.460 --> 00:15:59.260
Let me show you that in action, right?

00:15:59.260 --> 00:15:59.460
Cube CTL.

00:16:01.120 --> 00:16:05.760
The one that we are going to do is DJ 8 by 8 keep that in mind.

00:16:08.420 --> 00:16:09.760
Cube CTL label.

00:16:20.460 --> 00:16:22.220
Cube CTL label.

00:16:22.560 --> 00:16:27.180
I'm going to label a part the name of the part.

00:16:28.540 --> 00:16:32.380
I want to remove this label to remove a label the same command.

00:16:32.380 --> 00:16:39.240
You need to just put key minus key minus will remove the entire label on it from the resource.

00:16:40.540 --> 00:16:42.240
Okay, and label the same way.

00:16:42.240 --> 00:16:46.380
I'm going to remove the other label also other label is part template hash.

00:16:58.840 --> 00:17:01.380
Part template hash because I misspelled it.

00:17:19.880 --> 00:17:23.180
Come on, I just labeled it.

00:17:23.180 --> 00:17:24.560
What happened?

00:17:26.320 --> 00:17:27.500
Okay, it's already a label.

00:17:27.760 --> 00:17:30.380
So if I do Cube CTL get parts.

00:17:32.380 --> 00:17:33.600
Show labels.

00:17:52.640 --> 00:17:59.380
See this label will remove and you can see there is already a part created 69 seconds ago.

00:18:00.560 --> 00:18:05.840
This is the one that got created because after removing the label the current set became four.

00:18:05.860 --> 00:18:10.260
So it's been up a new point and it as in the labels on it.

00:18:10.760 --> 00:18:12.880
You can see we have six parts now.

00:18:12.880 --> 00:18:16.000
So if you delete this part nothing will happen.

00:18:16.380 --> 00:18:20.620
Because this is already an orphan part standalone part or fat.

00:18:23.480 --> 00:18:27.380
Okay, so it purely works by the label and again,

00:18:27.380 --> 00:18:34.060
if you label let's say while you are trying the hands-on try to assign these two label on this sixth part.

00:18:35.600 --> 00:18:42.120
Then the next moment when it queries all the six part will match to the sector label.

00:18:42.720 --> 00:18:46.000
Cube CTL get part selected then all six part will match.

00:18:47.220 --> 00:18:50.060
Which means current state is six desired state is five.

00:18:50.660 --> 00:18:52.960
So it will remove randomly one of the pocket.

00:18:53.060 --> 00:18:55.460
So in this case it is the same application.

00:18:55.460 --> 00:18:58.460
Even if you are going to run a standalone Postgres database

00:18:58.460 --> 00:19:01.760
and assign the same label here on the Postgres database,

00:19:02.700 --> 00:19:07.240
it may delete one of the one of the existing component or the Postgres component.

00:19:07.240 --> 00:19:10.680
It won't even see whether it is of the same family or not.

00:19:10.680 --> 00:19:13.980
It just blindly works by the labels on it,

00:19:13.980 --> 00:19:17.580
which means if you are if you are asserting some label here

00:19:17.580 --> 00:19:25.440
and if the replica set adopts this which means you successfully adopted and thought

00:19:26.800 --> 00:19:30.860
so quarantining or adopting both you can achieve with the help of the labels.

00:19:30.860 --> 00:19:33.800
I don't think in production you will be doing that

00:19:34.820 --> 00:19:39.460
but the reason why I explain this is how this we are saying

00:19:39.460 --> 00:19:42.520
we are talking about this hierarchy literally

00:19:42.520 --> 00:19:44.560
this hierarchy is completely loosely couple

00:19:45.460 --> 00:19:48.420
and it works only by the labels and labels as such

00:19:48.420 --> 00:19:50.540
the concept is pretty simple isn't it?

00:19:50.580 --> 00:19:52.900
You are going to assign some key value para and resource

00:19:54.160 --> 00:19:57.740
how to label using Cube CTL label command

00:19:57.740 --> 00:20:00.700
how to unlabel using Cube CTL label command

00:20:00.700 --> 00:20:03.860
how to use the label in the selector query

00:20:04.900 --> 00:20:12.060
how kubernetes resource like replica set uses label selector in its reconciliation loop

00:20:12.060 --> 00:20:20.320
and a simple demo on quarantining or adapting a part by labeling or unlabeling from it.

00:20:20.440 --> 00:20:21.760
That's all we discussed.

00:20:22.700 --> 00:20:26.820
I'm going to give a quick pause here for you to try this command

00:20:26.820 --> 00:20:28.700
and let me know for any questions.

00:20:29.640 --> 00:20:32.920
I will share this commands in the etherpad

00:20:36.560 --> 00:20:40.700
and if you confirmations please if it is clear good to try.

00:20:49.440 --> 00:20:53.140
Let me put it here this commands here.

00:20:53.940 --> 00:20:56.480
Thanks for that confirmation by the way.

00:20:57.460 --> 00:21:04.200
Okay, so labeling and labeling using label in the selector adopting quarantine.

00:21:04.300 --> 00:21:06.420
So this concept we discussed here.

00:21:06.780 --> 00:21:13.200
So at least let's take some five minutes at least to try this and explore the labels and try to assign an unlabel.

00:21:14.260 --> 00:21:18.100
So please spend some time on the hands-on because on the day two or day three,

00:21:18.300 --> 00:21:20.860
I will be giving a lot of exercises with scenarios.

00:21:22.840 --> 00:21:26.600
So I'm sure you will be able to crack all the scenarios that I provide.

00:21:26.700 --> 00:21:30.640
But what is more important from an examination perspective is timing.

00:21:31.200 --> 00:21:33.580
You will be really having a limited time.

00:21:34.020 --> 00:21:41.900
So you need to be really have fast hands while doing the samples, right?

00:21:41.920 --> 00:21:44.440
So if you try more during this hands-on time,

00:21:45.140 --> 00:21:50.840
then it will be simpler during the system or else we will take a lot of time just to solve one single.

00:21:52.140 --> 00:21:53.100
Use case.

00:21:54.280 --> 00:21:54.760
Okay.

00:21:56.080 --> 00:21:58.400
Yep, let's take some five to ten minutes.

00:21:58.440 --> 00:22:00.600
Not more than that to try the labels, please.

00:22:00.680 --> 00:22:01.600
Thanks for choice.