容器插件工具
简单方便查找镜像源信息,kubectl-images
代码地址:https://github.com/chenjiandongx/kubectl-images
此工具可以快捷执行命令来查看集群内ns,pod,及镜像等信息;
查看帮助项
~ 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默认选择所有ns
-A, --all-namespaces if present, list images in all namespaces.
## -c参数选择输出的内容,可选有命名空间、pod名称、容器名、容器镜像、镜像拉取策略、镜像大小,对应数字012345,例:-c 1,2,3
-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 指定ns名称
-n, --namespace string if present, list images in the specified namespace only. Use current namespace as fallback.
## -o参数可以设定输出的内容格式,例:-0 j 输出json格式内容
-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
使用示例
使用参数-n 指定ns,-c 指定需要的内容,-o 指定输出格式, “cbs”过滤名称含有此内容的容器
~ kubectl-images -n kube-system -c 0,1,2,3 -o j cbs
[
{
"namespace": "kube-system",
"pod": "csi-cbs-controller-******-mnvrh",
"container": "csi-provisioner",
"image": "ccr.ccs.tencentyun.com/tkeimages/csi-provisioner:v2.0.4"
},
{
"namespace": "kube-system",
"pod": "csi-cbs-controller-*****-mnvrh",
"container": "csi-attacher",
"image": "ccr.ccs.tencentyun.com/tkeimages/csi-attacher:v3.0.2"
},
这个查看有windows版和linux版,都可以使用;
下载地址:
https://github.com/chenjiandongx/kubectl-images/releases