1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/examples/policy_validate_nonRootUser.yaml

27 lines
612 B
YAML
Raw Normal View History

2019-08-21 12:38:15 -07:00
apiVersion: kyverno.io/v1alpha1
2019-06-22 16:05:06 -07:00
kind: Policy
metadata:
2019-08-21 12:38:15 -07:00
name: check-container-security-context
2019-06-22 16:05:06 -07:00
spec:
2019-08-21 12:38:15 -07:00
# validationFailureAction: "audit"
2019-06-22 16:05:06 -07:00
rules:
2019-08-21 12:38:15 -07:00
- name: check-root-user
exclude:
resources:
namespaces:
- kube-system
2019-07-25 14:57:44 -04:00
match:
resources:
kinds:
2019-08-21 12:38:15 -07:00
- Pod
2019-07-17 13:31:00 -07:00
validate:
2019-08-21 12:38:15 -07:00
message: "Root user is not allowed. Set runAsNonRoot to true."
anyPattern:
- spec:
securityContext:
runAsNonRoot: true
- spec:
containers:
- name: "*"
2019-06-22 16:05:06 -07:00
securityContext:
2019-06-24 18:51:11 -07:00
runAsNonRoot: true