从其他表达式的输出中检索 pod 描述(kubectl describe)

Retrieve pod description(kubectl describe) from the output of other expression

在kubectl中,describe和get -o可以用来获取资源的详细信息,我们能不能只获取一个被选中的列表的describe pods(不同的标签),我的情况是详细的用于分析的选定 pod 名称。我正在使用 describe 但无法获取特定的详细信息 pods,有很多需要手动完成。

如果是事件/特定标签,我可以执行以下操作但是需要其中 100 个pods 中的某些 pods 的更具体细节

kubectl get describe po -l app2=test > desc.txt
Kubectl get events -n test|grep -E 'app2|app3|hello1' > events.txt

尝试了下面的 returns 命名空间中所有 pods 的事件(没有帮助),任何更简单的方法或者可能无法完成或编写脚本来遍历 o/p?

kubectl get po -n test |grep -E 'app2|app3|hello1' |awk '{print }'|k describe po  -n test > desc.txt

感谢您的帮助!

你是说不能使用标签? 不确定我是否理解正确,但如果您需要按名称选择 pods - 这将起作用:

kubectl get pod -oname | grep -E 'app2|app3|hello' | xargs kubectl describe