WEBVTT

00:00.580 --> 00:06.640
Hello and welcome to this lecture. In this lecture we look at the different ways of manually scheduling

00:06.670 --> 00:13.700
a POD on a node. What do you do when you do not have a scheduler in your cluster?

00:13.700 --> 00:20.950
You, probably do not want to rely on the built in scheduler and instead want to schedule the PODs yourself.

00:21.020 --> 00:23.780
So how exactly does a scheduler work in the backend.

00:24.440 --> 00:27.230
Let's start with a simple pod definition file.

00:27.560 --> 00:33.860
Every POD has a field called NodeName that, by default, is not set.

00:33.860 --> 00:41.600
You don’t typically specify this field when you create the manifest file, Kubernetes adds it automtically.

00:41.600 --> 00:48.560
The scheduler goes through all the pods and looks for those that do not have this property set.

00:48.560 --> 00:51.460
Those are the candidates for scheduling.

00:51.530 --> 00:57.020
It then identifies the right node for the POD, by running the scheduling algorithm.

00:57.020 --> 01:03.680
Once identified it schedules the POD on the Node by setting the node Name property to the name of the

01:03.680 --> 01:12.240
node by creating a binding object. So if there is no scheduler to monitor and schedule nodes what happens?

01:12.330 --> 01:15.780
The pods continue to be in a pending state.

01:15.780 --> 01:17.270
So what can you do about it.

01:17.280 --> 01:23.340
You can manually assign pods to node yourself. Well without a scheduler,

01:23.340 --> 01:29.640
the easiest way to schedule a pod is to simply set the node name field to the name of the node in your

01:29.640 --> 01:33.540
pod specification while creating the POD.

01:33.540 --> 01:40.610
The pod then gets assigned to the specified node. You can only specify the node name at creation time.

01:40.710 --> 01:46.500
What if the pod is already created and you want to assign the pod to a node? Kubernetes won’t allow

01:46.500 --> 01:50.220
you to modify the node Name property of a pod.

01:50.370 --> 01:57.960
So another way to assign a note to an existing pod is to create a binding object and send a post request

01:57.960 --> 02:05.910
to the pod binding API thus mimicking what the actual scheduler does. In the binding object you specify

02:06.000 --> 02:13.740
a target node with the name of the node. Then send a post request to the pods binding API with the data

02:13.830 --> 02:17.580
set to the binding object in a JSON format.

02:17.580 --> 02:22.850
So you must convert the YAML file into its equivalent JSON format.

02:22.920 --> 02:24.960
Well that's it for this lecture.

02:24.960 --> 02:30.300
Head over to the practice test and practice manually scheduling pods on nodes.

