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
-
Identify noncompliant pods (run on any machine with kubectl access):
-
Choose a noncompliant workload and fetch its manifest (any machine with kubectl access). Example for a pod in namespace
defaultnamedmyapp-pod: -
Edit the manifest to add CPU and memory limits for each container (any machine with kubectl access). Open the file:
Under each
.spec.containers[].resourcessection, ensure something like:Adjust values per your capacity and application requirements. -
Recreate the pod with the updated manifest (any machine with kubectl access). Pods created by higher-level controllers (Deployments, StatefulSets, etc.) should be fixed at the controller level instead; for a standalone pod:
-
For pods managed by controllers (recommended in EKS), patch the controller instead of individual pods (any machine with kubectl access). Example for a Deployment
myapp-deployindefaultnamespace:In the editor, underspec.template.spec.containers[], add:Save and exit so the Deployment rolls out updated pods. -
Verify all non-system pods now have CPU and memory limits (any machine with kubectl access):
Ensure the output is
is_compliant=true.
Using kubectl
Using kubectl
On any machine with kubectl access:For each line, note In (adjust values to your policy; repeat for every container.)Apply the updated manifest:Adjust the container index in the path and the limit values as needed.Use the same approach (Edit All reported containers should now show non‑
- Identify non‑compliant Pods and their controllers
ownerKind and ownerName. Always patch the controller (Deployment/StatefulSet/DaemonSet/Job/CronJob), not the Pod, so the setting persists.- Example: patch a Deployment’s containers to add limits
/tmp/deploy.yaml, under each .spec.template.spec.containers[].resources, add:- Example: patch a single container in place (quick fix)
kubectl get ... -o yaml → edit → kubectl apply) for StatefulSets, DaemonSets, Jobs, and CronJobs.- For standalone Pods (no ownerReference)
/tmp/pod.yaml: remove fields under status:, remove metadata.uid, metadata.resourceVersion, metadata.creationTimestamp, and set resources.limits as above for each container. Then:- Verification
unset limitsCpu and limitsMemory and is_compliant=true.Automation
Automation

