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

27 lines
693 B
YAML

apiVersion : kyverno.io/v1alpha1
kind: ClusterPolicy
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