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

26 lines
661 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-17 13:33:05 -07:00
resource:
kinds:
- Deployment
selector :
matchLabels:
app.type: prod
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