mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 07:57:07 +00:00
30 lines
721 B
Markdown
30 lines
721 B
Markdown
# Disallow unknown image registries
|
|
|
|
Images from unknown registries may not be scanned and secured. Requiring the use of trusted registries helps reduce threat exposure.
|
|
|
|
You can customize this policy to allow image registries that you trust.
|
|
|
|
## Policy YAML
|
|
|
|
[restrict_image_registries.yaml](more/restrict_image_registries.yaml)
|
|
|
|
````yaml
|
|
apiVersion : kyverno.io/v1
|
|
kind: ClusterPolicy
|
|
metadata:
|
|
name: restrict-image-registries
|
|
spec:
|
|
validationFailureAction: audit
|
|
rules:
|
|
- name: validate-registries
|
|
match:
|
|
resources:
|
|
kinds:
|
|
- Pod
|
|
validate:
|
|
message: "Unknown image registry"
|
|
pattern:
|
|
spec:
|
|
containers:
|
|
- image: "k8s.gcr.io/* | gcr.io/*"
|
|
````
|