Containers must be required to run as non-root users. This policy ensures `runAsUser` is either unset or set to a number greater than zero.
apiVersion: kyverno.io/v1kind: ClusterPolicymetadata:name: require-run-as-non-root-userannotations:policies.kyverno.io/title: Require Run As Non-Root Userpolicies.kyverno.io/category: Pod Security Standards (Restricted)policies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Podkyverno.io/kyverno-version: 1.6.0kyverno.io/kubernetes-version: 1.22-1.23policies.kyverno.io/description: Containers must be required to run as non-root users. This policy ensures `runAsUser` is either unset or set to a number greater than zero.spec:validationFailureAction: Auditbackground: truerules:- name: run-as-non-root-usermatch:any:- resources:kinds:- Podvalidate:message: Running as root is not allowed. The fields spec.securityContext.runAsUser, spec.containers[*].securityContext.runAsUser, spec.initContainers[*].securityContext.runAsUser, and spec.ephemeralContainers[*].securityContext.runAsUser must be unset or set to a number greater than zero.pattern:spec:"=(securityContext)":"=(runAsUser)": ">0""=(ephemeralContainers)":- "=(securityContext)":"=(runAsUser)": ">0""=(initContainers)":- "=(securityContext)":"=(runAsUser)": ">0"containers:- "=(securityContext)":"=(runAsUser)": ">0"
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.
This policy ensures that the name of the ApplicationSet is the same value provided in the project.