Pinning Images by Digest
CI scans registry.example.com/api:1.8 with Trivy and it passes. Later someone pushes a different image under the same tag. How do you make sure Pods run exactly the image that was scanned?
registry.example.com/api:1.8
Choose one answer
Reference the image by its digest, e.g. registry.example.com/api@sha256:<digest>, which can't be moved.
registry.example.com/api@sha256:<digest>
Rescan the tag with Trivy in an admission webhook each time a Pod is created.
Set imagePullPolicy: IfNotPresent, so nodes keep the copy they pulled first.
imagePullPolicy: IfNotPresent
Set imagePullPolicy: Always, so every node pulls the image again under the tag on each Pod start and always runs the newest scanned one.
imagePullPolicy: Always