简体   繁体   中英

How to list Kubernetes in different namespaces by its kind?

I've a task list to Kubernetes pods by its kind. For Eg List kubernetes pods that are in different namespace using Jsonpath. I'm using the below command which is not working.

kubectl get pods -o jsonpath='{.items[?(@.items.kind=="Elasticsearch")]}'

您可以尝试使用以下命令。

kubectl get pods -o jsonpath='{.items[?(@.kind=="Pod")]}' --all-namespaces

要查看不同命名空间中的 pod:

kubectl get pods -o jsonpath='{.items[?(@.kind=="Pod")]}' -n <namespace-name>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM