k8s api request to get all resources

290 views
Skip to first unread message
Assigned to me

Amatzia Brandwein

unread,
Aug 27, 2018, 9:50:32 AM8/27/18
to Kubernetes user discussion and Q&A
Hello Guys

is there any way to preform and API request which return all resources (like running command 'kubectl get all')
I know i can get pods/services/etc.. by themselves but i am looking for a solution for getting everything in 1 call 
and not running multiple api calls to get each component

Thanks

Jaroslav Vojtek

unread,
Aug 27, 2018, 3:48:17 PM8/27/18
to kubernet...@googlegroups.com
Hi Amatzia, you can define API request which will return several resources at one call. Just type: "kubectl get pods,svc,...,... -all-namespaces"

Thanks
Best Regards
Jaroslav Vojtek

po 27. 8. 2018 o 15:50 Amatzia Brandwein <amatzia....@cybereason.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
To post to this group, send email to kubernet...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

tvansteenburgh

unread,
Aug 28, 2018, 9:22:14 AM8/28/18
to Kubernetes user discussion and Q&A
I don't think so. If you increase the logging level on kubectl like this:

kubectl get all -v 6

you'll see that kubectl is itself making an API request for each resource type, and aggregating the results.

Amatzia Brandwein

unread,
Aug 28, 2018, 11:20:26 AM8/28/18
to Kubernetes user discussion and Q&A
thats what i was trying to figure out.
i was trying to get components data from a remote machine via restful api without using "kubectl" command and i thought there was an "all" option
like in "kubectl" command but now i see its a bunch of requests and i will have to do the same and do multiple requests

Thank you very much for the answer :)
Reply all
Reply to author
Forward
0 new messages