mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
27 lines
No EOL
612 B
YAML
27 lines
No EOL
612 B
YAML
apiVersion: kyverno.io/v1alpha1
|
|
kind: Policy
|
|
metadata:
|
|
name: check-container-security-context
|
|
spec:
|
|
# validationFailureAction: "audit"
|
|
rules:
|
|
- name: check-root-user
|
|
exclude:
|
|
resources:
|
|
namespaces:
|
|
- kube-system
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: "Root user is not allowed. Set runAsNonRoot to true."
|
|
anyPattern:
|
|
- spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
- spec:
|
|
containers:
|
|
- name: "*"
|
|
securityContext:
|
|
runAsNonRoot: true |