More Info:
Verifies readOnlyRootFilesystem is true. A writable root filesystem lets an attacker persist tools or modify binaries inside a running container.Risk Level
MediumAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify noncompliant pods and their owning workloads (run on any machine with kubectl access):
-
For each affected Pod that is controlled by a Deployment/StatefulSet/DaemonSet/Job/CronJob, edit the owning workload manifest to set a read-only root filesystem (run on any machine with kubectl access). Example for a Deployment:
In each container (including
initContainersif present) underspec.template.spec.containers[]add or update: -
If a container needs write access to specific paths, mount an
emptyDirinstead of relying on a writable root (same edit session as step 2). Underspec.template.spec.volumesadd:Then, in the relevant container, add avolumeMountsentry: -
For standalone Pods (no controller in
ownerReferences), export, modify, and re-apply (run on any machine with kubectl access):Edit/tmp/pod-POD_NAME.yaml:- Remove fields
status,metadata.resourceVersion,metadata.uid,metadata.selfLink,metadata.creationTimestamp,metadata.managedFields. - Under each container and initContainer, set:
- Optionally define
emptyDirvolumes andvolumeMountsfor writable paths as in step 3. Then delete and recreate the Pod:
- Remove fields
-
Wait for updated workloads to roll out and ensure Pods are running (run on any machine with kubectl access):
-
Verify compliance (run on any machine with kubectl access):
Using kubectl
Using kubectl
On any machine with kubectl access:For each non‑compliant pod, note the Edit Apply the manifest:Adjust the container index in Apply with:
- Identify non‑compliant pods and owning controllers
OWNER from the audit output (e.g., Deployment, StatefulSet, DaemonSet, Job, CronJob) and patch that controller, not the Pod.- Example: patch a Deployment to use a read‑only root filesystem
/tmp/deploy.yaml and, for each affected container, ensure:- Example: patch a single container in a Deployment (no extra volumes needed)
/containers/0/ if needed.- Example: patch a DaemonSet similarly
- Example manifest snippet for new workloads
- Verification
is_compliant=true:Automation
Automation

