Skip to content

Instantly share code, notes, and snippets.

@reegnz
Last active August 29, 2022 12:50
Show Gist options
  • Save reegnz/e14d214cc64d5e175bdf742ba2d557be to your computer and use it in GitHub Desktop.
Save reegnz/e14d214cc64d5e175bdf742ba2d557be to your computer and use it in GitHub Desktop.
Listing all container images being used in kubernetes cluster

Listing all container images being used in kubernetes cluster

Getting all images referenced in pod specs:

kubectl get pods -A -o json  |
  jq -r '[.items[].spec | (.initContainers // empty | .[].image), .containers[].image] | unique | sort | .[]'

Getting all images cached on nodes:

kubectl get nodes -A -o json  | jq -r '[.items[].status.images[].names[-1]] | unique | sort | .[]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment