Description
ImagePolicyWebhook asks an external backend whether to admit an image. Signature or vulnerability checks must be implemented by that backend or another admission policy.
Potential impact
An unapproved image can be deployed when no policy checks its source or approval status.
Remediation
Define the allowed registries and image approval or signature requirements. If you use this webhook, connect it to the backend over TLS. Test an approved image, a disallowed image and the configured response to a backend outage.
Examples
These Kubernetes 1.30.0 excerpts show API server arguments. AlwaysAdmit in the first excerpt performs no image checks.
Before
apiVersion: v1
kind: Pod
metadata:
name: kube-apiserver
spec:
containers:
- name: kube-apiserver
image: registry.k8s.io/kube-apiserver:v1.30.0
command:
- kube-apiserver
args:
- --enable-admission-plugins=AlwaysAdmit
After
apiVersion: v1
kind: Pod
metadata:
name: kube-apiserver
spec:
containers:
- name: kube-apiserver
image: registry.k8s.io/kube-apiserver:v1.30.0
command:
- kube-apiserver
args:
- --enable-admission-plugins=ImagePolicyWebhook
- --admission-control-config-file=/etc/kubernetes/image-policy-webhook.yaml
For the second excerpt, also enable --runtime-config=imagepolicy.k8s.io/v1alpha1=true. Supply the AdmissionConfiguration at the stated path and make the webhook configuration and its TLS kubeconfig readable by the API server.