What api endpoint can I call to get a pod or service's yaml?
The kubectl command to get a pod's yaml is
kubectl get pod my-pod -o yaml
but what endpoint does kubectl use to get it?
kubectl get pod my-pod -o yaml
but what endpoint does kubectl use to get it?
If you add -v 7
or -v 6
to the command, you get verbose logs that show you all the API requests
Example:
kubectl get pods -v 6
I0816 22:59:03.047132 11794 loader.go:372] Config loaded from file: /Users/jonas/.kube/config
I0816 22:59:03.060115 11794 round_trippers.go:454] GET https://127.0.0.1:52900/api/v1/namespaces/default/pods?limit=500 200 OK in 9 milliseconds
So you see that it does this API request:
/api/v1/namespaces/default/pods?limit=500
The API only returns the response in Json and the client can transform to Yaml when using -o yaml
.