1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/samples/RestrictImageRegistries.md

31 lines
721 B
Markdown
Raw Normal View History

2019-10-23 14:06:03 -07:00
# Disallow unknown image registries
2020-11-11 15:55:02 -05:00
Images from unknown registries may not be scanned and secured. Requiring the use of trusted registries helps reduce threat exposure.
2019-10-23 15:36:37 -07:00
You can customize this policy to allow image registries that you trust.
2019-10-23 14:06:03 -07:00
2020-11-11 15:55:02 -05:00
## Policy YAML
2019-10-23 14:06:03 -07:00
2020-11-11 15:55:02 -05:00
[restrict_image_registries.yaml](more/restrict_image_registries.yaml)
2019-10-23 14:06:03 -07:00
````yaml
2019-11-13 13:56:20 -08:00
apiVersion : kyverno.io/v1
2019-10-23 14:06:03 -07:00
kind: ClusterPolicy
metadata:
2019-11-10 18:13:01 -08:00
name: restrict-image-registries
2019-10-23 14:06:03 -07:00
spec:
validationFailureAction: audit
2019-10-23 14:06:03 -07:00
rules:
2019-11-10 18:13:01 -08:00
- name: validate-registries
2019-10-23 14:06:03 -07:00
match:
resources:
kinds:
- Pod
validate:
message: "Unknown image registry"
2019-10-23 14:06:03 -07:00
pattern:
spec:
containers:
- image: "k8s.gcr.io/* | gcr.io/*"
````