WEBVTT

00:04.180 --> 00:07.150
Hello and welcome to this lecture in this lecture.

00:07.180 --> 00:10.000
we will talk about Kube Scheduler.

00:10.000 --> 00:15.540
Earlier we discussed that the kubernetes scheduler is responsible for scheduling pods on nodes.

00:16.300 --> 00:18.640
Now don't let the graphic mislead you.

00:18.670 --> 00:26.710
remember the scheduler is only responsible for deciding which pod goes on which node. It doesn’t actually

00:26.710 --> 00:29.010
place the pod on the nodes.

00:29.050 --> 00:34.690
That’s the job of the kubelet. The kubelet or the captain on the ship is who creates the pod on the

00:34.690 --> 00:35.610
ships.

00:35.610 --> 00:39.860
The scheduler only decides which pod goes where.

00:40.000 --> 00:43.270
Let's look at how the scheduler does that in a bit more detail.

00:43.420 --> 00:48.770
First of all why do you need a scheduler? When there are many ships and many containers,

00:48.940 --> 00:53.450
You want to make sure that the right container ends up on the right ship.

00:53.590 --> 00:57.670
For example there could be different sizes of ships and containers.

00:57.670 --> 01:04.130
You want to make sure the ship has sufficient capacity to accommodate those containers different ships

01:04.150 --> 01:06.280
maybe going to different destinations.

01:06.280 --> 01:11.740
You want to make sure your containers are placed on the right ships so they end up in the right destination

01:12.540 --> 01:17.170
In kubernetes, the scheduler decides which nodes the pods are placed on

01:17.170 --> 01:22.660
depending on certain criteria.  You may have PODs with different resource requirements,

01:22.720 --> 01:27.180
You can have nodes in the cluster dedicated to certain applications.

01:27.280 --> 01:33.700
So how does the scheduler assign these PODs? The scheduler looks at each POD and tries to find the

01:33.700 --> 01:35.280
best node for it.

01:35.290 --> 01:37.560
For example, let’s take one of these PODs.

01:37.810 --> 01:41.970
The big blue one. It has a set of CPU and Memory requirements.

01:42.040 --> 01:47.980
The scheduler goes through two phases to identify the best node for the pod in the first phase.

01:48.010 --> 01:52.940
The scheduler tries to filter out the nodes that do not fit the profile for this pod.

01:53.050 --> 01:59.830
For example, the nodes that do not have sufficient CPU and memory resources requested by the pod.

01:59.860 --> 02:06.100
So the first two small nodes are filtered out.  So we are now left with two nodes on which the POD

02:06.130 --> 02:07.870
can be placed.

02:07.900 --> 02:14.660
Now how does the scheduler pick one from the two the scheduler ranks the node to identify the best fit

02:14.660 --> 02:15.580
for the pod.

02:15.620 --> 02:21.240
It uses a priority function to assign a score to the nodes on a scale of 0 to 10.

02:21.260 --> 02:28.130
For example the scheduler calculates the amount of resources that would be free on the nodes after placing

02:28.130 --> 02:29.570
the pod on them.

02:29.570 --> 02:36.230
In this case, the one on the right would have 6 CPUs free  if the pod was placed on it which is 4 more

02:36.560 --> 02:39.430
than the other one so it gets a better rank.

02:39.530 --> 02:40.820
And so it wins.

02:40.910 --> 02:43.220
So that's how a scheduler works at a high level.

02:43.280 --> 02:48.380
And of course these can be customized and you can write your own scheduler as well.

02:48.380 --> 02:53.660
There are many more topics to look at such as resource requirements, limits, taints and tolerations,

02:53.690 --> 03:00.290
node selectors, affinity rules etc. Which is why we have an entire section dedicated to scheduling coming

03:00.290 --> 03:04.940
up in this course where we will discuss each of these in much more detail.

03:04.940 --> 03:10.040
For now we will continue to focus on the scheduler as a process at a high level.

03:10.760 --> 03:13.160
So how do you install the kube-scheduler?

03:13.160 --> 03:18.740
Download the kube-scheduler from the kubernetes release page. Extract it and run it as a service.

03:19.220 --> 03:20.600
when you run it as a service.

03:20.600 --> 03:23.090
You specify the scheduler configuration file.

03:23.570 --> 03:26.240
So how do you view the kube-scheduler server options?

03:26.240 --> 03:31.820
Again, if you set it up with kubeadm tool, kubeadm deploys the kube-scheduler as a pod

03:31.820 --> 03:33.450
in the kube-system namespace

03:33.470 --> 03:39.030
on the master node. You can see the options within the pod definition file located at etc

03:39.090 --> 03:41.270
kubernetes manifests folder.

03:41.420 --> 03:46.280
You can also see the running process and the effective options by listing the process on the master

03:46.280 --> 03:49.250
node and searching for kube-scheduler.

03:49.250 --> 03:51.020
Well that's it for this lecture.

03:51.200 --> 03:52.550
I will see you in the next.

