Skip to content

Repository files navigation

kubectl-analyze-images

kubectl analyze-images table output

kubectl analyze-images gives you an at-a-glance view of the largest and most-used container images in a Kubernetes cluster, with image sizes, pod usage, and cached-on-node counts in one easy-to-scan report.

Installation

Install script

curl -fsSL https://raw.githubusercontent.com/ronaknnathani/kubectl-analyze-images/main/install.sh | sh

By default, the script installs to /usr/local/bin when writable, otherwise ~/.local/bin. Override with INSTALL_DIR=/path/to/bin.

GitHub releases

Download the latest archive for your platform from the releases page, then place the binary on your PATH.

krew

kubectl krew install analyze-images

Source

git clone https://github.com/ronaknnathani/kubectl-analyze-images.git
cd kubectl-analyze-images
make build
make install

Requires Go 1.26+.

Usage

kubectl analyze-images
kubectl analyze-images -n production -l app=web
kubectl analyze-images --context=prod --kubeconfig=/path/to/kubeconfig
kubectl analyze-images --sort-by=pods --top-images=50
kubectl analyze-images -o json
kubectl analyze-images --truncate-image-names --image-name-parts=2

How it works

The plugin lists pods and nodes with read-only Kubernetes API calls. Pod specs provide usage counts, while node status provides image sizes and cached-on-node counts. For namespace or label-filtered runs, it reports only matching pod images and enriches them with node image data when available.

Development

make build          # Run deps, tests, lint, then build the plugin
make test           # Run tests
make lint           # Run pinned golangci-lint
make ci             # Run the same checks as GitHub Actions
make check          # Run tests and linter
make test-coverage  # Run tests with coverage report
make snapshot       # Build snapshot release locally

Releasing

make ci
git tag -a vX.Y.Z -m "Release vX.Y.Z"
git push origin vX.Y.Z

GoReleaser publishes release artifacts via GitHub Actions. Update plugins/analyze-images.yaml with checksums from the release before distributing via krew.

License

MIT. See LICENSE.

About

Find the largest and most-used container images at a glance.

Topics

Resources

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages