1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-07 00:17:13 +00:00
kyverno/examples/demo/7_container_security_context/policy.yaml

27 lines
685 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-17 17:09:18 -07:00
# readOnlyRootFilesystem: true