Review Kubernetes container image version selection

Choose a verified image version and manage changes deliberately.

Description

latest is a valid default tag when no tag or digest is given. Its name tells you neither the release date nor which image was verified. A numbered version tag can also move to a different image.

Potential impact

A tag change can alter what starts next and make it difficult to reproduce the image running at the time of an incident.

Remediation

Choose a verified, maintained image and pin its digest if you need the same content on each deployment. Test patches and feature changes before updating the reference.

Examples

Both examples set imagePullPolicy: Always. Replace the historical 1.21 with a supported version for deployment.

Before

yaml
apiVersion: v1
kind: Pod
metadata:
  name: private-image-test
spec:
  containers:
    - name: app
      image: nginx:latest
      imagePullPolicy: Always

nginx:latest resolves the current target of latest at each start.

After

yaml
apiVersion: v1
kind: Pod
metadata:
  name: private-image-test
spec:
  containers:
    - name: app
      image: nginx:1.21
      imagePullPolicy: Always

nginx:1.21 names a version, but the registry can still change what that tag points to.

References