mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
27 lines
686 B
YAML
27 lines
686 B
YAML
apiVersion : kyverno.io/v1alpha1
|
|
kind: Policy
|
|
metadata:
|
|
name: container-security-context
|
|
spec:
|
|
rules:
|
|
- name: validate-user-privilege
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Deployment
|
|
selector :
|
|
matchLabels:
|
|
app.type: prod
|
|
validate:
|
|
message: "validate container security contexts"
|
|
pattern:
|
|
spec:
|
|
template:
|
|
spec:
|
|
containers:
|
|
- securityContext:
|
|
runAsNonRoot: true
|
|
allowPrivilegeEscalation: false
|
|
# fields can be customized
|
|
# privileged: false
|
|
# readOnlyRootFilesystem: true
|