python
python copied to clipboard
X-Stream-Protocol-Version is required on connect_get_namespaced_pod_exec function
kubernetes.client.exceptions.ApiException: (500) when I tried to execute on kubernetes client for one of the pods
res = stream(client.connect_get_namespaced_pod_exec(pod_name, ns, container=container_name, command=comm,stderr=True, stdin=False,stdout=True, tty=False))
kubernetes.client.exceptions.ApiException: (500) Reason: Internal Server Error HTTP response headers: HTTPHeaderDict({'Cache-Control': 'no-cache, no-store, must-revalidate', 'Content-Type': 'application/json', 'Expires': '0', 'Pragma': 'no-cache', 'Date': 'Wed, 10 Aug 2022 05:02:03 GMT', 'Content-Length': '70'}) HTTP response body: {"message":"unable to upgrade: X-Stream-Protocol-Version is required"}
Environment:
-
Kubernetes version (
kubectl version): Client Version: v1.24.1 Kustomize Version: v4.5.4 -
OS : MacOS 10.13.6
-
Python version - 3.8
-
Python client version - 24.2.0
Could you please try this example and see if that works?
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
Is this issue sorted? I have a similar issue
Handler 'pod_event' failed with an exception. Will ignore. Traceback (most recent call last): File "/home/kubitus-pod-cleaner-operator/.local/lib/python3.10/site-packages/kubernetes/stream/ws_client.py", line 509, in websocket_call client = WSClient(configuration, url, headers, capture_all) File "/home/kubitus-pod-cleaner-operator/.local/lib/python3.10/site-packages/kubernetes/stream/ws_client.py", line 65, in init self.sock = create_websocket(configuration, url, headers) File "/home/kubitus-pod-cleaner-operator/.local/lib/python3.10/site-packages/kubernetes/stream/ws_client.py", line 475, in create_websocket websocket.connect(url, **connect_opt) File "/home/kubitus-pod-cleaner-operator/.local/lib/python3.10/site-packages/websocket/_core.py", line 248, in connect self.handshake_response = handshake(self.sock, url, *addrs, **options) File "/home/kubitus-pod-cleaner-operator/.local/lib/python3.10/site-packages/websocket/_handshake.py", line 57, in handshake status, resp = _get_resp_headers(sock) File "/home/kubitus-pod-cleaner-operator/.local/lib/python3.10/site-packages/websocket/_handshake.py", line 148, in _get_resp_headers raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) websocket._exceptions.WebSocketBadStatusException: Handshake status 500 Internal Server Error
During handling of the above exception, another exception occurred:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.