ImagePolicyWebhook on admission-controllers for kubernetes
Use kube-admission-image for customized image verification or scanning
This will define the game rules for admission
- images name specification
- images unauthorized source Specification
- images size specification
- images startup specifications
- images known vulnerability scan
- go get github.com/weiqiang333/kube-admission-image
- go run kube-admission-image.go
- docker pull weiqiang333/kube-admission-image
-
Create a TLS certificate to protect the webhook service
-
kubernetes will be accessed via the TLS protocol
-
kube-apiserver admission-control add ImagePolicyWebhook Control plugin
-
config admission-control-config-file
-
load kube-admission-image kubeconfig
- First, create the TLS secret required by the webhook:
kubectl -n kube-system create secret tls tls-kube-admission-image \
--key kube-admission-image-key.pem \
--cert kube-admission-image.pem
- deploy kube-admission-image
kubectl apply -f configs/kubernetes/kube-admission-image-deployment.yaml
-
Test with curl request
-
Pass deploy test
- pigeon version is: ImagePolicyWebhook entry rules inspection, but do not refuse
- Usually for the stability of the environment, we need pigeon version to find non-compliant admission images, and use the official version after correcting them
- tag: pigeon, images: weiqiang333/kube-admission-image:pigeon
- Pay attention to using strategy logic to avoid chicken and egg problems