kubernetes客户端corev1api connect_get_namespaced_pod_exec无法为python运行。在
我已经检查了python version==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)
出现以下错误:
ApiException: (0) Reason: hostname '10.47.7.95' doesn't match either of '', 'cluster.local'
没有直接使用CoreV1Api的流-
跑步:
^{pr2}$出现以下错误:
ApiException: (400) Reason: Bad Request HTTP response headers: HTTPHeaderDict({'Date': 'Sat, 05 Jan 2019 08:01:22 GMT', 'Content-Length': '139', 'Content-Type': 'application/json'}) HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Upgrade request required","reason":"BadRequest","code":400}
我编写了一个简单的程序来检查:
它对我来说工作得很好。在
我相信您使用
^{pr2}$minikube
进行开发。它无法识别您的主机名。您可以通过在程序中禁用assert_hostname
来使其工作,例如:这应该可以解决您的问题。在
相关问题 更多 >
编程相关推荐