Python: read_namespaced_deployment response as json

Created on 16 Sep 2019  路  4Comments  路  Source: kubernetes-client/python

Is there a method to get a json response from the client AppsV1Api _read_namespaced_deployment_ api call. This would be for any GET deployment command.

I would expect there is a way to leverage -o similar to the command below.
kubectl get deploy istio-telemetry -n istio-system -o json

Please advise if this method exists or is missing,

Environment:

  • Kubernetes version: 1.13
  • OS, MacOS 10.14.6
  • Python version: 3.7.3
  • Python client version: 10.0.1
kinbug

Most helpful comment

setting _preload_content to false gives you the raw json undecoded

All 4 comments

Same problem.

setting _preload_content to false gives you the raw json undecoded

setting _preload_content to false gives you the raw json undecoded

Thanks a lot!!! It works well. I could get my custom resources directly.

Example:
api_response = v1.read_namespaced_deployment(name, namespace, _preload_content=False).read()

Was this page helpful?
0 / 5 - 0 ratings