Description
My apologies, I posted this as a continuation of issue #138 but noticed afterwards that it was closed, so I'm posting this a new issue.
I am able to successfully execute the connect_get_namespaced_pod_exec() function on my local minikube instance. But when I run the same script against my Google GKE instance, I receive the following error:
websocket._exceptions.WebSocketBadStatusException: Handshake status 404
I have included "assert_hostname = False" as per the recommendation on #138 . And am able to connect and run other queries against my GKE instance's API server (like like list pods, list namespaces, etc).
Any help would be greatly appreciated. I've included my sample script below along with the error trace. Thanks.
-----Sample script --------------
from kubernetes import client, config
config.load_kube_config()
client.Configuration().assert_hostname=False
v1=client.CoreV1Api()
resp = v1.connect_get_namespaced_pod_exec('hello-minikube-3015430129-6spcw', 'default',
command='ls',
stderr=False, stdin=False,
stdout=False, tty=False)
print ("resp: %s" % resp)
------- Error ---------------------------
Traceback (most recent call last):
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/ws_client.py", line 231, in websocket_call
client = WSClient(configuration, url, headers)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/ws_client.py", line 63, in init
self.sock.connect(url, header=header)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/websocket/_core.py", line 214, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/websocket/_handshake.py", line 65, in handshake
status, resp = _get_resp_headers(sock)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/websocket/_handshake.py", line 122, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d", status)
websocket._exceptions.WebSocketBadStatusException: Handshake status 404
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "podExec.py", line 10, in
stdout=False, tty=False)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/apis/core_v1_api.py", line 907, in connect_get_namespaced_pod_exec
(data) = self.connect_get_namespaced_pod_exec_with_http_info(name, namespace, **kwargs)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/apis/core_v1_api.py", line 1012, in connect_get_namespaced_pod_exec_with_http_info
collection_formats=collection_formats)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/api_client.py", line 329, in call_api
_return_http_data_only, collection_formats, _preload_content, _request_timeout)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/api_client.py", line 153, in __call_api
_request_timeout=_request_timeout)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/api_client.py", line 355, in request
headers=headers)
File "/home/pat/dev/python/kube/lib/python3.5/site-packages/kubernetes/client/ws_client.py", line 237, in websocket_call
raise ApiException(status=0, reason=str(e))
kubernetes.client.rest.ApiException: (0)
Reason: Handshake status 404