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_containerSecurityContext.yaml

28 lines
686 B
YAML
Raw Normal View History

2019-07-17 13:33:05 -07:00
apiVersion : kyverno.io/v1alpha1
kind: Policy
metadata:
name: container-security-context
spec:
rules:
2019-07-17 17:09:18 -07:00
- name: validate-user-privilege
2019-07-25 14:57:44 -04:00
match:
resources:
kinds:
- Deployment
selector :
matchLabels:
app.type: prod
2019-07-17 13:33:05 -07:00
validate:
message: "validate container security contexts"
pattern:
spec:
template:
spec:
containers:
2019-07-17 17:09:18 -07:00
- securityContext:
runAsNonRoot: true
allowPrivilegeEscalation: false
# fields can be customized
2019-07-17 13:33:05 -07:00
# privileged: false
2019-07-29 19:01:17 -07:00
# readOnlyRootFilesystem: true