More Info:
Verifies every container sets resources.limits.cpu and resources.limits.memory so a single workload cannot exhaust a node.Risk Level
MediumAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List non-compliant pods (run on any machine with kubectl access):
-
Choose one non-compliant pod and check if it is controlled by a higher-level object (run on any machine with kubectl access):
- If empty: fix the Pod manifest directly (step 3).
- If it has an owner (e.g., Deployment, StatefulSet, Job, CronJob, ReplicaSet, DaemonSet): fix that owner resource (step 4); do not edit the pod directly.
-
For a standalone Pod: export its manifest, edit, and re-apply (run on any machine with kubectl access):
Edit
/tmp/pod-POD_NAME.yamland under each.spec.containers[].resourcesensure:Then delete the running pod and recreate it from the edited manifest: -
For controller-managed pods: edit the controller so all its containers set limits (run on any machine with kubectl access). Example for a Deployment:
In the editor, for each container under
spec.template.spec.containers[], ensure:Save and exit. Kubernetes will roll out updated pods automatically.
Use the equivalentkubectl edit statefulset,kubectl edit daemonset,kubectl edit job, orkubectl edit cronjobfor other controllers. -
(Optional but recommended) Enforce limits via a LimitRange in each namespace so new pods must set them (run on any machine with kubectl access):
-
Verify all non-exempt pods and containers now have CPU and memory limits (run on any machine with kubectl access):
The output should be
is_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access:If multiple containers exist, include each container as a separate entry in the Apply the manifest:Repeat similar edits for other controllers (StatefulSet, DaemonSet, Job, CronJob) so all their containers define both CPU and memory limits.
- Identify pods/containers missing limits (example, focused view):
- For each affected pod, edit the owning workload manifest to add
resources.limits.cpuandresources.limits.memoryfor every container.
containers array with its own name and resources.limits.For objects managed via manifests (GitOps, IaC), update the YAML instead and apply:- Verify compliance:
Automation
Automation

