Skip to main content

☑️ Ensure each container has a configured memory request

Memory requests allow you to use memory resources efficiently and allow you to allocate a guaranteed minimum of computing resources for the pods running in your cluster.

Targeted objects by this rule (types of kind): Deployment / Pod / DaemonSet / StatefulSet / ReplicaSet / CronJob / Job

Complexity: hard (What does this mean?)

Policy as code identifier: CONTAINERS_MISSING_MEMORY_REQUEST_KEY


This rule will fail

If a container doesn't have a memory request configured

spec:
containers:
- name: app
image: nginx:1.19.8

Rule output in the CLI

$ datree test *.yaml

>> File: failExample.yaml
❌ Ensure each container has a configured memory request [1 occurrence]
💡 Missing property object `requests.memory` - value should be within the accepted boundaries recommended by the organization

How to fix this failure

spec:
containers:
- name: app
image: nginx:1.19.8
resources:
requests:
memory: "64Mi"

Read more