mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-13 15:57:31 +00:00
26 lines
661 B
YAML
26 lines
661 B
YAML
|
apiVersion : kyverno.io/v1alpha1
|
||
|
kind: Policy
|
||
|
metadata:
|
||
|
name: container-security-context
|
||
|
spec:
|
||
|
rules:
|
||
|
- name: validate-user-privilege
|
||
|
resource:
|
||
|
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
|