本文介绍了kubernetes列出所有正在运行的Pod名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找列出所有豆荚名称的选项
I looking for the option to list all pods name
如何不使用awk(或剪切).现在我正在使用此命令
How to do without awk (or cut). Now i'm using this command
kubectl get --no-headers=true pods -o name | awk -F "/" '{print $2}'
推荐答案
您可以使用kubectl内置的go templating选项来格式化输出,以仅显示每个Pod的名称.
You can use the go templating option built into kubectl to format the output to just show the names for each pod:
kubectl get pods --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}'
这篇关于kubernetes列出所有正在运行的Pod名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!