Skip to content

Set readOnlyRootFilesystem to true in container security context #1213

@gugu

Description

@gugu

Proposal

I'm trying to avoid containers eating node's ephemeral storage and have kyverno policy, which checks for readOnlyRootFilesystem. I think it won't be a problem to enable readOnlyRootFilesystem for containers. It will also increase container security by reducing attack scope

$ k describe pod -n mysql ps-db-haproxy-1
...
Warning  PolicyViolation  3m22s  kyverno-scan  policy require-ro-rootfs/validate-readOnlyRootFilesystem fail: validation error: Root filesystem must be read-only. rule validate-readOnlyRootFilesystem failed at path /spec/containers/0/securityContext/

k describe pod -n mysql ps-db-mysql-1
...
Warning  PolicyViolation  26m   kyverno-scan  policy require-ro-rootfs/validate-readOnlyRootFilesystem fail: validation error: Root filesystem must be read-only. rule validate-readOnlyRootFilesystem failed at path /spec/containers/0/securityContext/

Use-Case

No response

Is this a feature you are interested in implementing yourself?

Maybe

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions