Exploring the Effects by Violating Quotas
Explore how to violate some quotas and analyze the consequences.
Exploring the effects
Now let’s create the objects and explore the effects as we defined the resource quotas in the previous lesson.
Creating the dev
namespace
Let’s get started by creating the dev
namespace as per our plan:
kubectl create ns devkubectl create \-f dev.yml \--record --save-config
We can see from the output that the namespace "dev"
is created
as well as the resourcequota "dev"
. To be on the safe side, we’ll describe the newly created dev
quota.
kubectl --namespace dev describe \quota dev
The output is as follows:
Name: devNamespace: devResource Used Hard-------- ---- ----limits.cpu 0 1limits.memory 0 1Gipods 0 10requests.cpu 0 800mrequests.memory 0 500Miservices.nodeports 0 0
We can see that the hard limits are set and that there’s currently no usage. This is expected since we’re not running any objects in the dev namespace.
Creating resources
Let’s create go-demo-2
objects:
kubectl --namespace dev create \-f go-demo-2.yml \--save-config --recordkubectl --namespace dev \rollout status \deployment go-demo-2-api
We created the objects from the go-demo-2.yml
file and waited until the go-demo-2-api
Deployment rolled out.
Looking into the description
Now we can revisit the values of the dev
quota.
kubectl --namespace dev describe \quota dev
The output is as follows:
Name: devNamespace: devResource Used Hard-------- ---- ----limits.cpu 400m 1limits.memory 130Mi 1Gipods 4 10requests.cpu 40m 800mrequests.memory 65Mi 500Miservices.nodeports 0 0
Judging from the Used
column, we can see that we are currently running 4
Pods and still below the limit of 10``. One of those Pods are created through the
...