kubernetes 客户端 corev1api connect_get_namespaced_pod_exec 无法为 python 运行。
我已经检查了 python 版本 == 2.7 和 pip freeze - ipaddress==1.0.22, urllib3==1.24.1 和 websocket-client==0.54.0 是满足要求的版本 - 如此处所述:https:/ /github.com/kubernetes-client/python/blob/master/README.md#hostname-doesnt-match 关注此线程上的问题 - https://github.com/kubernetes-client/python/issues/36 - 不是大有帮助。
尝试使用此处建议的流 - https://github.com/kubernetes-client/python/blob/master/examples/exec.py
冉:
api_response = stream(core_v1_api.connect_get_namespaced_pod_exec,
name, namespace,
command=exec_command,
stderr=True, stdin=False,
stdout=True, tty=False)
Run Code Online (Sandbox Code Playgroud)
得到这个错误:
ApiException: (0) 原因:主机名 '10.47.7.95' 不匹配 '', 'cluster.local'
没有直接使用 CoreV1Api 的流 -
冉:
core_v1_api = client.CoreV1Api()
api_response = core_v1_api.connect_get_namespaced_pod_exec(name=name,namespace=namespace,command=exec_command,stderr=True, stdin=False,stdout=True, tty=False)
Run Code Online (Sandbox Code Playgroud)
得到这个错误:
ApiException: (400) 原因:错误请求 HTTP 响应标头:HTTPHeaderDict({'Date': 'Sat, 05 Jan 2019 08:01:22 GMT', 'Content-Length': '139', 'Content-Type': …