获取已部署图像的值 helm/kubernetes

Get values of deployed images helm/kubernetes

我正在寻找一种简单的方法来查找我在 kubernetes 环境中部署的图像版本。

我能找到的最接近我想要的东西是 helm get values <namespace> -a
(但这会获取值并转储所有(计算的)值)

是否有 easier/clean 方法来获取部署的图像和版本列表?

提前致谢

您可以使用 kubectl 获取 pods 运行 中的所有图像 namespace/cluster。参见 List All Container Images Running in a Cluster

对于一个命名空间:

kubectl get pods -n <namespace> -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq -c

对于整个集群:

kubectl get pods --all-namespaces -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq -c

我用的是这样的:

kubectl get po --all-namespaces -o yaml | grep image: | cut -d ":" -f2,3 | sort | uniq

此命令显示集群中使用的所有映像并删除重复项。