The Mismatch Scenario

Explore what happens when a Namespace's defined limits are violated.

Let’s see what happens when resources are defined, but they do not match the Namespace min and max limits.

Looking into the definition#

We’ll use the same go-demo-2.yml we used before. The output, limited to the relevant parts, is as follows.

Definition of 'go-demo-2'

What matters is that the resources for both Deployments are defined.

Creating resources#

Let’s create the objects and retrieve the events. They will help us understand better what is happening.

Apply 'go-demo-2' in Namespace 'test'

The output of the latter command, limited to the relevant parts, is as follows.

Output of above command

We can see that we are forbidden from creating either of the two Pods. The difference between those events is in what caused Kubernetes to reject our request.

The go-demo-2-db-* Pod could not be created because its maximum memory usage per Container is 80Mi, but limit is 100Mi. On the other hand, we are forbidden from creating the go-demo-2-api-* Pods because the minimum memory usage per Container is 10Mi, but request is 5Mi.

All the containers within the test Namespace will have to comply with the min and max limits. Otherwise, we are forbidden from creating them.

Container limits cannot be higher than the Namespace max limits. On the other hand, container resource requests cannot be smaller than Namespace min limits.

If we think about Namespace limits as lower and upper thresholds, we can say that container requests cannot be below them, and that container limits can’t be above.

ℹ️ Please press the CTRL and c keys to stop watching the events.

Destroying the Namespace#

We’ll delete the test Namespace before we move into the next subject.

Delete Namespace

Try it yourself#

A list of all the commands used in the lesson is given below.

Commands used in this Lesson

You can practice the commands in the following code playground by pressing the Run button and waiting for the cluster to set up.

/
go-demo-2-random.yml
go-demo-2-no-res.yml
limit-range.yml
go-demo-2.yml
Mismatch scenario

Defining Resource Defaults and Limitations within a Namespace
Defining Resource Quotas for a Namespace
Mark as Completed
Report an Issue