1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/test/scenarios/policy_validate_nonRootUser.yaml
2019-10-09 21:06:49 -07:00

27 lines
No EOL
619 B
YAML

apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
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