0

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")]}'
Akshay G
  • 2,070
  • 1
  • 15
  • 33

2 Answers2

1

You can try to use the following command.

kubectl get pods -o jsonpath='{.items[?(@.kind=="Pod")]}' --all-namespaces
Lejdi Prifti
  • 183
  • 6
  • 1
    you can also use the Shorthand `-A` insted of `--all-namespaces` [shortcut for typing kubectl --all-namespaces everytime](https://stackoverflow.com/a/57542244/4018180) – Akshay G Oct 06 '21 at 15:57
0

To see the pods in different namespace:

kubectl get pods -o jsonpath='{.items[?(@.kind=="Pod")]}' -n <namespace-name>
Vallabha Vamaravelli
  • 1,153
  • 1
  • 9
  • 15