Kubernetes – list all deployed images with sha256 hash

While there is official documentation how to list all kubernetes images here, it’s missing imageID field that includes sha256 hash. Sha256 digest is crucial for our use-case at Reliza, so here are working commands to list all images and all image ids:

# get all imageIDs (with sha256 hash digest)
kubectl get pods --all-namespaces -o jsonpath="{.items[*].status.containerStatuses[0].imageID}"

Notes:

  • Tried on kubernetes 1.17
  • Images returned are whitespace separated
  • Images are duplicated (one image per pod) – but should be trivial to de-duplicate