Search⌘ K

The Mismatch Scenario

Explore how Kubernetes manages resource allocation by enforcing namespace minimum and maximum memory limits on containers. Understand why pods are rejected when resource requests or limits fall outside these boundaries and gain practical skills to resolve resource mismatch issues using real deployment examples.

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 that we used before. The output, (limited to the relevant parts) is as follows.

YAML
...
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-demo-2-db
spec:
...
template:
...
spec:
containers:
- name: db
image: mongo:3.3
resources:
limits:
memory: 100Mi
cpu: 0.1
requests:
memory: 50Mi
cpu: 0.01
...
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-demo-2-api
spec:
...
template:
...
spec:
containers:
- name: api
...
resources:
limits:
memory: 10Mi
cpu: 0.1
requests:
memory: 5Mi
cpu: 0.01
...

In this output, the resources for both Deployments are defined.

Creating resources

Let’s create the objects and retrieve the ...