I i'm making Kubernetes HTTP Request GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
This gives response in json but i want response in json.
Does Kubernetes give response in yaml? if yes, let me know how to do it?
When running curl requests you can tell api-server to send you yaml formated output by setting Accept: application/yaml
header. Take a look at example below:
curl --header "Accept: application/yaml" "/apis/[...]"
Or you can also use some external tool to convert from json to yaml, e.g. yq
:
curl "/apis/[...]" | yq -y .
where -y
stands for yaml output.