• Stars
    star
    237
  • Rank 169,885 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🕸 Show container images used in the cluster.

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/json/yaml 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

# Refer to the link: https://github.com/chenjiandongx/kubectl-images/releases
# Download the binary and then...
$ 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 images info in yaml format
  kubectl images -oy

  # 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, 4:ImagePullPolicy, 5:ImageSize] (default "1,2,3")
  -C, --context string         The name of the kubeconfig context to use.
  -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.
  -o, --output-format string   output format. [json(j)|table(t)|yaml(y)] (default "table")
  -u, --unique                 Unique images group by namespace/container/images/pullPolicy.
      --version                version for kubectl-images

🔖 Glances

~ 🐶 kubectl images -n kube-system -oy dns
- pod: coredns-78fcd69978-9pbjh
  container: coredns
  image: k8s.gcr.io/coredns/coredns:v1.8.4
- pod: coredns-78fcd69978-jh7m2
  container: coredns
  image: k8s.gcr.io/coredns/coredns:v1.8.4

~ 🐶 kubectl images -A -c 0,1,3
[Summary]: 2 namespaces, 11 pods, 11 containers and 9 different images
+-------------+----------------------------------------+--------------------------------------------+
|  Namespace  |                  Pod                   |                   Image                    |
+-------------+----------------------------------------+--------------------------------------------+
| kube-system | coredns-78fcd69978-9pbjh               | k8s.gcr.io/coredns/coredns:v1.8.4          |
+             +----------------------------------------+                                            +
|             | coredns-78fcd69978-jh7m2               |                                            |
+             +----------------------------------------+--------------------------------------------+
|             | etcd-docker-desktop                    | k8s.gcr.io/etcd:3.5.0-0                    |
+             +----------------------------------------+--------------------------------------------+
|             | kube-apiserver-docker-desktop          | k8s.gcr.io/kube-apiserver:v1.22.5          |
+             +----------------------------------------+--------------------------------------------+
|             | kube-controller-manager-docker-desktop | k8s.gcr.io/kube-controller-manager:v1.22.5 |
+             +----------------------------------------+--------------------------------------------+
|             | kube-proxy-vc7fv                       | k8s.gcr.io/kube-proxy:v1.22.5              |
+             +----------------------------------------+--------------------------------------------+
|             | kube-scheduler-docker-desktop          | k8s.gcr.io/kube-scheduler:v1.22.5          |
+             +----------------------------------------+--------------------------------------------+
|             | storage-provisioner                    | docker/desktop-storage-provisioner:v2.0    |
+             +----------------------------------------+--------------------------------------------+
|             | vpnkit-controller                      | docker/desktop-vpnkit-controller:v2.0      |
+-------------+----------------------------------------+--------------------------------------------+
| nginx       | nginx-deployment-66b6c48dd5-s9wv5      | nginx:1.14.2                               |
+             +----------------------------------------+                                            +
|             | nginx-deployment-66b6c48dd5-wmn9x      |                                            |
+-------------+----------------------------------------+--------------------------------------------+

~ 🐶 kubectl images -A -c 0,1,3 -u
[Summary]: 2 namespaces, 11 pods, 11 containers and 9 different images
+-------------+----------------------------------------+--------------------------------------------+
|  Namespace  |                  Pod                   |                   Image                    |
+-------------+----------------------------------------+--------------------------------------------+
| kube-system | coredns-78fcd69978-9pbjh               | k8s.gcr.io/coredns/coredns:v1.8.4          |                                      +
+             +----------------------------------------+--------------------------------------------+
|             | etcd-docker-desktop                    | k8s.gcr.io/etcd:3.5.0-0                    |
+             +----------------------------------------+--------------------------------------------+
|             | kube-apiserver-docker-desktop          | k8s.gcr.io/kube-apiserver:v1.22.5          |
+             +----------------------------------------+--------------------------------------------+
|             | kube-controller-manager-docker-desktop | k8s.gcr.io/kube-controller-manager:v1.22.5 |
+             +----------------------------------------+--------------------------------------------+
|             | kube-proxy-vc7fv                       | k8s.gcr.io/kube-proxy:v1.22.5              |
+             +----------------------------------------+--------------------------------------------+
|             | kube-scheduler-docker-desktop          | k8s.gcr.io/kube-scheduler:v1.22.5          |
+             +----------------------------------------+--------------------------------------------+
|             | storage-provisioner                    | docker/desktop-storage-provisioner:v2.0    |
+             +----------------------------------------+--------------------------------------------+
|             | vpnkit-controller                      | docker/desktop-vpnkit-controller:v2.0      |
+-------------+----------------------------------------+--------------------------------------------+
| nginx       | nginx-deployment-66b6c48dd5-s9wv5      | nginx:1.14.2                               |
+-------------+----------------------------------------+--------------------------------------------+

~ 🐶 kubectl images -c 0,1,2,3,4 -n nginx -oj
[
 {
  "namespace": "nginx",
  "pod": "nginx-deployment-66b6c48dd5-s9wv5",
  "container": "nginx",
  "image": "nginx:latest",
  "imagePullPolicy": "IfNotPresent"
 },
 {
  "namespace": "nginx",
  "pod": "nginx-deployment-66b6c48dd5-wmn9x",
  "container": "nginx",
  "image": "nginx:latest",
  "imagePullPolicy": "IfNotPresent"
 }
]

📃 License

MIT ©chenjiandongx

More Repositories

1

mzitu

👧 美女写真套图爬虫(二)
Python
1,041
star
2

magnet-dht

✌️ Python3 BitTorrent DHT crawler
Python
935
star
3

sniffer

🤒 A modern alternative network traffic sniffer.
Go
703
star
4

mandodb

🤔 A minimize Time Series Database, written from scratch as a learning project. 从零开始实现一个 TSDB
Go
645
star
5

torrent-cli

🔨 磁力获取器命令行工具
Python
640
star
6

awesome-asyncio-cn

😎 Python Asyncio 精选资源列表,囊括了网络框架,库,软件等资源
Makefile
594
star
7

bili-spider

📺 B 站全站视频信息爬虫
Python
581
star
8

cup-size

👀 关于女性文胸尺码的深入探讨
Python
553
star
9

mmjpg

👩 美女写真套图爬虫(一)
Python
479
star
10

51job-spider

🔎 前程无忧 Python 招聘岗位信息爬取和分析
Python
396
star
11

async-proxy-pool

🔅 Python3 异步爬虫代理池
Python
371
star
12

Github-spider

Github 仓库及用户分析爬虫
Python
251
star
13

stackoverflow-spider

📖 爬取 Stackoverflow 100万 条问答并简单分析
Python
206
star
14

pixiv

P 站非会员查看人气作品
Python
185
star
15

soksaccounts

🔥 Shadowsocks 账号爬虫
Python
157
star
16

ginprom

📡 Prometheus metrics exporter for Gin.
Go
151
star
17

how

📝 Impressive Linux commands cheat sheet (Python).
Python
124
star
18

gitv

🤟 A git repos analyzing and visualizing tool built in Rust. 我的开源报告
Rust
123
star
19

yummy-girls

🚜 无他,唯手熟尔
JavaScript
79
star
20

pls

✏️ Impressive Linux commands cheat sheet CLI written in Go.
Go
78
star
21

weekly-email-subscribe

阮一峰技术周刊邮件订阅
Python
76
star
22

prometheus101

📘 Prometheus 折腾笔记
73
star
23

clock

☁️ 须知少时凌云志 曾许人间第一流
Go
72
star
24

HupuLive

🏀 虎扑篮球直播命令行版
Python
70
star
25

oscar

🐶 Next generation building tool for nothing
Go
67
star
26

jianweibo

基于 Python Flask 的微博系统
Python
62
star
27

grogudb

🐸 Grogudb is a KV Database designed for fast write/scan heavy workloads.
Go
58
star
28

pinger

📌 A portable ping library written in Go
Go
57
star
29

yap

🚥 Yet another pinger: A high-performance ICMP ping implementation build on top of BPF technology.
Go
53
star
30

bili-video-rank

🔦 B 站视频各项数据排行榜
JavaScript
42
star
31

fy

🌐 Translate words via command line
Python
37
star
32

photo-gevent

👮 美女写真图爬虫 gevent 版
Python
36
star
33

kubectl-count

🎊 Count resources by kind
Go
36
star
34

Qt

Qt 小项目
C++
32
star
35

wallpaper

zol 手机壁纸爬虫(简单分布式?)
Python
27
star
36

collections

📂 Golang 实现的 collections 模块,灵感来自 Python queue 和 Python collections
Go
27
star
37

pytreemap

🌲 树图渲染命令行工具
Python
26
star
38

make-it-colorful

🎨 使用卷积神经网络给图片上色
25
star
39

photo-asyncio

🙉 美女写真图爬虫 asyncio 版
Python
24
star
40

async-bili-spider

📹 B 站异步爬虫初体验
Python
23
star
41

pyocr

利用 tesseract 解析简单数字验证码图片
Python
20
star
42

lolly

🍭 文字动态图生成工具
Python
18
star
43

youdao-go

📘 Golang 有道词典命令行版
Go
18
star
44

aura

🔔 Aura is an SDK for the monitoring system written in Go with love
Go
16
star
45

hupu-referee-report

🏀 虎扑步行街裁判报告
JavaScript
16
star
46

zhihu-zhuanlan

如何分析一个知乎大 V 的专栏文章
Python
15
star
47

photo-go

👼 美女写真图爬虫 Golang 版
Go
15
star
48

pymysql-connection-pool

pymysql 连接池
Python
14
star
49

pyhtime

🕜 一个用来将 datetime 时间转化成更加人性化的 时间描述字符串的库
Python
13
star
50

tszlist

🔗 tszlist 是一种时序数据线程安全链表
Go
11
star
51

emoji.py

🔍 emoji 表情命令行搜索工具
Python
8
star
52

slipper

🍮 Async HTTP Requests-like library based on Aiohttp
Python
7
star
53

photo-trio

👲 美女写真图爬虫 trio 版
Python
7
star
54

skrskr

🤙 当 Python 遇到大碗面 Freestyle 太 Skr 了
Python
6
star
55

mim-system

利用 flask 实现的数据库小作业网站
Python
6
star
56

kslb

🍬 The missing Service Loadbalance for Kubernetes(Just for fun).
Go
6
star
57

wetalk

📠 wetalk is a chatroom application for coders based on websockets
Go
5
star
58

pprofsnapshot

🧶 pprofsnapshot makes it easy to download profiling data to local.
Go
5
star
59

dockerstats

🐳 The easy way to collect docker stats.
Go
4
star
60

gh-contributors

🔖 Github 项目贡献者 Markdown 文档表格生成工具
Python
3
star
61

memcached-collector

📤 Collect metrics from memcached servers using aura.
Go
3
star
62

logger

⚡ A lightweight, auto-rolling logger for Go.
Go
3
star
63

docs-need-space

📗 文档空格检查工具
Python
3
star
64

grogudb-benchmark

grogudb benchmark project
Go
1
star