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 (run on any machine with kubectl access):
-
For each listed Pod, edit the owning workload manifest (e.g., Deployment) to set a read-only root filesystem (run on any machine with kubectl access; example for a Deployment):
In the opened spec, under each
.spec.template.spec.containers[](and.initContainers[]if present) add or modify:Save and exit to apply the change. -
If the container needs a writable path, add an
emptyDirvolume and mount it there (run on any machine with kubectl access; continue in the same edit):- Under
spec.template.spec.volumes: - Under the container that needs write access:
nameandmountPathto match the application’s needs. Do not removereadOnlyRootFilesystem: true. - Under
-
For Pods created directly (no controller), update or recreate their manifests (run on any machine with kubectl access):
- Export the Pod spec:
- Edit the file, adding:
under each container and initContainer, and optionally add
emptyDir+volumeMountsas in step 3. - Delete and recreate:
- Export the Pod spec:
-
Allow the workloads to roll out the updated Pods and confirm all Pods are running (run on any machine with kubectl access):
-
Verification (run on any machine with kubectl access):
The output should be
is_compliant=truewhen all applicable containers use a read-only root filesystem.
Using kubectl
Using kubectl
On any machine with kubectl access:In Apply the updated manifest:Repeat the same pattern for other controllers (StatefulSet, DaemonSet, CronJob, Job) by replacing Adjust the container index
- Edit the Pod’s controller manifest (Deployment example)
/tmp/deploy.yaml, under each container (and initContainer) that should be read‑only, add or update:deploy and the kind in the kubectl get call.- Directly patch a running Pod (only if it is not controlled by a Deployment/StatefulSet/etc.)
/0/ or patch additional containers as needed.If a Pod-level initContainer also needs the setting:- Verification
Automation
Automation

