We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python : get error "Upgrade request required" for exec command using exec with connect_get_namespaced_pod_exec
when I create the pod with python api I can use kubectl and run the following commands successfully at linux command line:
kubectl exec secret-pod --namespace=production cat data/busybox/username and kubectl exec secret-pod --namespace=production cat data/busybox/password
The following python code fails with "Upgrade request required"
def _get_user_token(self): try: user = self.core_api_instance.connect_get_namespaced_pod_exec(name="secret-pod", namespace="production", command=["cat /data/busybox/username"], stderr=True, stdin=False, stdout=True, tty=False) pprint(user) except ApiException as e: print("Exception when calling CoreV1Api->get_namespaced_pod_exec: %s\n" % e)
exec_cmd = ['cat /data/busybox/password'] try: passwd = self.core_api_instance.connect_get_namespaced_pod_exec(name="secret-pod", namespace='production', command=["cat /data/busybox/password"], stderr=True, stdin=False, stdout=True, tty=False) pprint(passwd) except ApiException as e: print("Exception when calling CoreV1Api->get_namespaced_pod_exec: %s\n" % e) return {'user': user, 'password': passwd}
The text was updated successfully, but these errors were encountered:
I upgraded kubernetes python package from 4.0.0 to 6.0.0 and websocket-client to 0.47.0 and it did not fix this
Sorry, something went wrong.
This is fixed by using a stream: code change:
user_name_str = stream(self.core_api_instance.connect_get_namespaced_pod_exec, name, namespace,command=exec_command1, stderr=True, stdin=False, stdout=True, tty=False)
Is there an example for stream with tty? to emulate kubectl exec -ti
kubectl exec -ti
@adubkov Examples are at https://github.com/kubernetes-client/python/blob/master/examples/exec.py where interestingly enough the one that runs interactively works for me, the one that does not hangs for me.
No branches or pull requests
Python : get error "Upgrade request required" for exec command using exec with connect_get_namespaced_pod_exec
when I create the pod with python api I can use kubectl and run the following commands successfully at linux command line:
kubectl exec secret-pod --namespace=production cat data/busybox/username
and
kubectl exec secret-pod --namespace=production cat data/busybox/password
The following python code fails with "Upgrade request required"
def _get_user_token(self):
try:
user = self.core_api_instance.connect_get_namespaced_pod_exec(name="secret-pod",
namespace="production",
command=["cat /data/busybox/username"],
stderr=True, stdin=False,
stdout=True, tty=False)
pprint(user)
except ApiException as e:
print("Exception when calling CoreV1Api->get_namespaced_pod_exec: %s\n" % e)
The text was updated successfully, but these errors were encountered: