Let's go over the labs on resource requests and limits.
The first question is, a pod called rabbit is deployed.
Identify the CPU request requirements set on the pod.
Let's do kubectrl get pod and see if there is rabbit pod.
Let's do kubectrl describe pod rabbit.
If you look at the section right here,
we have CPU limits and CPU requests.
The CPU request as requested here is one, so let's select one.
The next task is to delete the rabbit pod,
kubectrl delete pod rabbit.
Now, another pod called elephant has been created.
Let's check that.
We have pod called elephant and it fails to get to a running state,
inspect this pod and identify the reason why it's not running.
Let's do kubectrl describe pod elephant.
If you look at this section here called Last State,
it says the reason is OOMKilled.
Basically, that indicates that it's a memory issue,
so the reason is OOMKilled, select that.
The status OOMKilled indicates that it is failing
because the pod ran out of memory.
Identify the memory limit set on the pod.
The memory limit is, as you can see here, it's 10 Mi.
That's the memory limit set on this pod.
The elephant pod runs a process that consume 15 Mi of memory.
Increase the limit of the elephant pod to 20
and delete and recreate the pod if required.
One thing we have to do is to change it.
As you can see here,
the command used to create this part is the stress command.
It basically gets the pod to use 15 megabytes of memory,
but the limit is 10.
That's the reason why it's getting killed.
We've got to change this to 20.
One of the ways to do that
is to do a kubectrl edit pod elephant.
But the problem is we might not be able to change
the limit with an edit.
We're going to give it a shot anyway, so let's give it 20 and save.
What this says is that you cannot basically edit
the limit set to a running pod.
Anyway, let's come out of it, but our changes are saved in this file,
so that's a temporary file.
Let's check that.
If you look at the resource limits that we have set,
it's actually saved here, our change is saved here.
What we could do is we could just use this file to recreate the pod.
We can either delete the pod and then recreate it
or an easier way is to just use the kubectrl replace command
and then with the force.
It actually deletes the existing pod and recreates it and give that file.
Let's change it here kubectrl replace force -f and then the file name.
It basically deletes the elephant pod and then recreates it.
Let's see the status now.
We see that it's in a running state.
Let's also verify
that the limit that we set is now reflecting.
We have just checked and made sure that it's in a running state.
The next task is to delete pod.
We'll just give it a few seconds for the process to terminate.
Okay.
That's the end of this lab.