The Mismatch Scenario
Explore what happens when a Namespace's defined limits are violated.
We'll cover the following
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.
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.
The output of the latter command, limited to the relevant parts, is as follows.
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
testNamespace will have to comply with theminandmaxlimits. 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
CTRLandckeys to stop watching the events.
Destroying the Namespace#
We’ll delete the test Namespace before we move into the next subject.
Try it yourself#
A list of all the commands used in the lesson is given below.
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-no-res.yml
 
