kubernetes-client / python

Official Python client library for kubernetes
http://kubernetes.io/
Apache License 2.0
6.76k stars 3.27k forks source link

There is no way to determine the exit code for an exec command #2300

Open rubenvw-ngdata opened 1 day ago

rubenvw-ngdata commented 1 day ago

What is the feature and why do you need it:

Would be handy to identify the exit code for a command being executed. This holds information about whether the command has succeeded.

Describe the solution you'd like to see: GET /api/v1/namespaces/{namespace}/pods/{name}/exec to return an object that holds exit code, stdin, stdout and stderr separately

ofrzeta commented 13 hours ago

Hi, does this example not do what you want? https://github.com/kubernetes-client/python/blob/master/examples/pod_exec.py You can either exec with _preload_content=False or continuously read from the stream response.