WEBVTT

00:00.467 --> 00:06.743
Let's go over the labs
on resource requests and limits.

00:07.493 --> 00:10.743
The first question is,
a pod called rabbit is deployed.

00:10.823 --> 00:14.513
Identify the CPU request
requirements set on the pod.

00:14.723 --> 00:20.843
Let's do kubectrl get pod
and see if there is rabbit pod.

00:21.293 --> 00:26.723
Let's do kubectrl describe pod rabbit.

00:29.363 --> 00:35.453
If you look at the section right here,

00:35.723 --> 00:39.833
we have CPU limits and CPU requests.

00:40.433 --> 00:45.473
The CPU request as requested here is one,
so let's select one.

00:49.163 --> 00:52.987
The next task is to delete the rabbit pod,

00:53.067 --> 00:56.633
kubectrl delete pod rabbit.

01:08.573 --> 01:11.553
Now, another pod called
elephant has been created.

01:11.633 --> 01:13.763
Let's check that.

01:15.743 --> 01:20.393
We have pod called elephant
and it fails to get to a running state,

01:20.633 --> 01:24.803
inspect this pod and identify
the reason why it's not running.

01:24.953 --> 01:29.573
Let's do kubectrl describe pod elephant.

01:31.553 --> 01:35.783
If you look at this section
here called Last State,

01:36.293 --> 01:40.043
it says the reason is OOMKilled.

01:40.583 --> 01:44.123
Basically,
that indicates that it's a memory issue,

01:45.113 --> 01:48.533
so the reason is OOMKilled, select that.

01:51.443 --> 01:54.393
The status OOMKilled
indicates that it is failing

01:54.473 --> 01:56.598
because the pod ran out of memory.

01:56.843 --> 02:00.233
Identify the memory limit set on the pod.

02:00.353 --> 02:06.413
The memory limit is,
as you can see here, it's 10 Mi.

02:06.893 --> 02:09.393
That's the memory limit set on this pod.

02:11.903 --> 02:16.613
The elephant pod runs a process
that consume 15 Mi of memory.

02:17.573 --> 02:20.423
Increase the limit of the elephant pod to 20

02:22.013 --> 02:24.763
and delete and recreate the pod if required.

02:27.833 --> 02:31.433
One thing we have to do is to change it.

02:31.553 --> 02:32.223
As you can see here,

02:32.303 --> 02:35.253
the command used to create
this part is the stress command.

02:35.333 --> 02:42.203
It basically gets the pod
to use 15 megabytes of memory,

02:43.403 --> 02:44.613
but the limit is 10.

02:44.693 --> 02:47.318
That's the reason why it's getting killed.

02:47.723 --> 02:50.333
We've got to change this to 20.

02:51.653 --> 02:53.120
One of the ways to do that

02:53.200 --> 02:57.623
is to do a kubectrl edit pod elephant.

02:59.693 --> 03:02.593
But the problem
is we might not be able to change

03:03.200 --> 03:08.883
the limit with an edit.

03:08.963 --> 03:14.033
We're going to give it a shot anyway,
so let's give it 20 and save.

03:15.323 --> 03:20.033
What this says
is that you cannot basically edit

03:20.753 --> 03:22.691
the limit set to a running pod.

03:28.373 --> 03:34.563
Anyway, let's come out of it,
but our changes are saved in this file,

03:34.643 --> 03:36.331
so that's a temporary file.

03:37.133 --> 03:38.408
Let's check that.

03:40.343 --> 03:44.673
If you look at the resource
limits that we have set,

03:44.753 --> 03:47.463
it's actually saved here,
our change is saved here.

03:47.543 --> 03:54.173
What we could do is we could just
use this file to recreate the pod.

03:54.953 --> 03:57.213
We can either delete
the pod and then recreate it

03:57.293 --> 04:01.253
or an easier way is to just use
the kubectrl replace command

04:02.273 --> 04:04.623
and then with the force.

04:04.703 --> 04:09.023
It actually deletes the existing pod
and recreates it and give that file.

04:17.093 --> 04:24.053
Let's change it here kubectrl
replace force -f and then the file name.

04:25.373 --> 04:29.373
It basically deletes the elephant
pod and then recreates it.

04:29.453 --> 04:31.133
Let's see the status now.

04:33.353 --> 04:35.603
We see that it's in a running state.

04:35.723 --> 04:37.553
Let's also verify

04:42.203 --> 04:45.563
that the limit that we set
is now reflecting.

04:51.743 --> 04:55.523
We have just checked and made
sure that it's in a running state.

04:59.363 --> 05:03.863
The next task is to delete pod.

05:11.633 --> 05:16.253
We'll just give it a few seconds
for the process to terminate.

05:18.323 --> 05:19.323
Okay.

05:20.453 --> 05:22.141
That's the end of this lab.

