Skip to main content

☑️ Ensure each container has a configured CPU request

CPU requests enable you to use CPU resources efficiently and 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_CPU_REQUEST_KEY


This rule will fail

If a container doesn't have a CPU 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 CPU request [1 occurrence]
💡 Missing property object `requests.cpu` - 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:
cpu: "250m"

Read more