python icon indicating copy to clipboard operation
python copied to clipboard

X-Stream-Protocol-Version is required on connect_get_namespaced_pod_exec function

Open balu-ce opened this issue 3 years ago • 1 comments
trafficstars

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

balu-ce avatar Aug 10 '22 05:08 balu-ce

Could you please try this example and see if that works?

roycaihw avatar Aug 15 '22 16:08 roycaihw

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Nov 13 '22 17:11 k8s-triage-robot

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:

chiranjeevivarma avatar Dec 06 '22 04:12 chiranjeevivarma

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Jan 05 '23 04:01 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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 avatar Feb 04 '23 04:02 k8s-triage-robot

@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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

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.

k8s-ci-robot avatar Feb 04 '23 04:02 k8s-ci-robot