/kubectl-images

๐Ÿ•ธ show container images used in the cluster.

Primary LanguageGoMIT LicenseMIT

kubectl-images

๐Ÿ•ธ Show container images used in the cluster.

kubectl-images makes use of the kubectl command. It first calls kubectl get pods to retrieve pods details and filters out the container image information of each pod, then prints out the final result in a table view.

๐Ÿ”ฐ Installation

Krew

$ kubectl krew install images
Updated the local copy of plugin index.
Installing plugin: images
Installed plugin: images
\
 | Use this plugin:
 | 	kubectl images
 | Documentation:
 | 	https://github.com/chenjiandongx/kubectl-images
/

Build from source code

$ git clone https://github.com/chenjiandongx/kubectl-images.git
$ cd kubectl-images && go build -ldflags="-s -w" -o kubectl-images . && mv ./kubectl-images /usr/local/bin
$ kubectl images --help

Download the binary

export VERSION=0.3.0

# Linux
$ curl -Lo kubectl-images https://github.com/chenjiandongx/kubectl-images/releases/download/v${VERSION}/kubectl-images_linux_amd64
# MacOS
$ curl -Lo kubectl-images https://github.com/chenjiandongx/kubectl-images/releases/download/v${VERSION}/kubectl-images_darwin_amd64
# Windows
$ curl -Lo kubectl-images https://github.com/chenjiandongx/kubectl-images/releases/download/v${VERSION}/kubectl-images_windows_amd64

$ chmod +x kubectl-images && mv kubectl-images /usr/local/bin/
$ kubectl images --help

๐Ÿ“ Usage

~ ๐Ÿถ kubectl images --help
Show container images used in the cluster.

Usage:
  kubectl-images [podname-regex] [flags]

Examples:
  # display a table of all images in current namespace using podName/containerName/containerImage as columns.
  kubectl images

  # display a table of images that match 'nginx' podname regex in 'dev' namespace using podName/containerImage as columns.
  kubectl images -n dev nginx -c 1,2

Flags:
  -A, --all-namespaces     if present, list images in all namespaces.
  -c, --columns string     specify the columns to display, separated by comma. [0:Namespace, 1:PodName, 2:ContainerName, 3:ContainerImage] (default "1,2,3")
  -h, --help               help for kubectl-images
  -k, --kubeconfig string  path to the kubeconfig file to use for CLI requests.
  -n, --namespace string   if present, list images in the specified namespace only. Use current namespace as fallback.
      --version            version for kubectl-images

๐Ÿ”– Glances

image image

๐Ÿ“ƒ License

MIT ยฉchenjiandongx