1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 01:46:55 +00:00
kyverno/examples/best_practices/policy_validate_deny_runasrootuser.yaml

28 lines
626 B
YAML
Raw Normal View History

apiVersion: kyverno.io/v1alpha1
kind: ClusterPolicy
metadata:
name: validate-deny-runasrootuser
spec:
validationFailureAction: "audit"
rules:
- name: deny-runasrootuser
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
# pattern:
# spec:
# containers:
# - name: "*"
# securityContext:
# runAsNonRoot: true