Skip to main content

More Info:

Verifies every container sets resources.limits.cpu and resources.limits.memory so a single workload cannot exhaust a node.

Risk Level

Medium

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Manual Steps

  1. On any machine with kubectl access, list all non-system pods and identify containers missing limits:
  2. For a pod managed by a higher-level controller (e.g., Deployment), find the owning resource and export its manifest:
  3. Edit the manifest and add resources.limits.cpu and resources.limits.memory for every container in spec.template.spec.containers (replace values with appropriate limits):
    Under each container:
  4. Apply the updated manifest so Kubernetes recreates pods with limits:
  5. For standalone Pods (no controller owner), export, edit, and recreate them with limits (this will delete and recreate the pod):
  6. Verify all non-system containers now have both CPU and memory limits using the benchmark audit command on any machine with kubectl access:
On any machine with kubectl access:
  1. Identify non-compliant pods and their controllers
Focus on the owning controllers (e.g. Deployment, StatefulSet, DaemonSet, Job, CronJob) rather than editing bare Pods where possible.
  1. Patch a Deployment to add limits (example)
Replace namespace, name, and limit values as appropriate.
  1. Patch a StatefulSet (example)
  1. Patch a DaemonSet (example)
  1. Patch a Job or CronJob (examples)
Job:
CronJob:
  1. For workloads managed by manifests (GitOps/IaC)
Edit the manifest used to create the controller, for each container:
Apply:
  1. Verification
Run the audit command again and confirm either full compliance or only excluded namespaces appear: