A read-only root file system helps to enforce an immutable infrastructure strategy; the container only needs to write on the mounted volume that persists the state. An immutable root filesystem can also prevent malicious binaries from writing to the host system. This policy validates that containers define a securityContext with `readOnlyRootFilesystem: true`.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-ro-rootfsannotations:policies.kyverno.io/title: Require Read-Only Root Filesystempolicies.kyverno.io/category: Best Practices, EKS Best Practices, PSP Migrationpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podpolicies.kyverno.io/minversion: 1.6.0policies.kyverno.io/description: "A read-only root file system helps to enforce an immutable infrastructure strategy; the container only needs to write on the mounted volume that persists the state. An immutable root filesystem can also prevent malicious binaries from writing to the host system. This policy validates that containers define a securityContext with `readOnlyRootFilesystem: true`."spec:validationFailureAction: Auditbackground: truerules:- name: validate-readOnlyRootFilesystemmatch:any:- resources:kinds:- Podvalidate:message: Root filesystem must be read-only.pattern:spec:containers:- securityContext:readOnlyRootFilesystem: true
This policy performs some best practices validation on Application fields. Path or chart must be specified but never both. And destination.name or destination.server must be specified but never both.
This policy prevents the use of the default project in an Application.
This policy prevents updates to the project field after an Application is created.