Skip to main content

More Info:

Verifies every container sets resources.requests so the scheduler can place the pod correctly and QoS is not BestEffort.

Risk Level

Low

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. Identify noncompliant pods (any machine with kubectl access):
  2. For pods managed by higher-level controllers (Deployment, StatefulSet, DaemonSet, Job, CronJob), edit the controller manifest to add requests (any machine with kubectl access). Example for a Deployment:
    In each affected container under spec.template.spec.containers[], ensure a block like:
    Save and exit to let Kubernetes roll out updated pods.
  3. For standalone Pods (no controller in ownerReferences), edit the Pod spec directly (any machine with kubectl access). Note this recreates the pod:
    In /tmp/pod-POD_NAME.yaml, under each spec.containers[], add:
    Remove ephemeral runtime fields (status, metadata.resourceVersion, metadata.uid, metadata.creationTimestamp, metadata.managedFields) and apply:
  4. If manifests are managed via GitOps or other IaC, make the same resources.requests.cpu and resources.requests.memory changes in the source YAML for each container, then let your deployment pipeline apply them. Do not rely on kubectl edit for these resources.
  5. Repeat steps 2–4 for all listed noncompliant pods until every container in each pod has both CPU and memory requests defined.
  6. Verify compliance (any machine with kubectl access):
    Confirm the output is is_compliant=true or that all listed containers show is_compliant=true.
On any machine with kubectl access:
  1. Identify non-compliant pods and their controllers
  1. For each workload controller (Deployment/DaemonSet/StatefulSet/Job/CronJob), edit the manifest and add resources.requests for every container.
Example for a Deployment:
Edit /tmp/deploy-with-requests.yaml and, for each container under spec.template.spec.containers, add:
(Adjust values as appropriate for the application.)Apply the updated manifest:
  1. For standalone Pods (no controller), recreate them with requests set.
Export, edit, and reapply:
In /tmp/pod-with-requests.yaml:
  • Remove the entire metadata.uid, metadata.resourceVersion, metadata.creationTimestamp, metadata.managedFields, status sections.
  • Under each spec.containers[], add:
Then:
  1. Verification
On any machine with kubectl access: