下载文件https://github.com/openshift/origin/blob/master/examples/hello-openshift/hello-pod.json并执行以下命令:
oc cluster up
oc create -f hello-pod.json
oc get pod hello-openshift -o yaml |grep podIP
它将返回 IP 地址,比如说:
podIP: 172.17.0.6
执行命令:
curl 172.17.0.6:8080
它将返回 curl: (7) 连接172.17.0.6 8080端口失败:操作超时
信息:
oc v3.10.0+dd10d17
kubernetes v1.10.0+b81c8f8
features: Basic-Auth
Server https://127.0.0.1:8443
openshift v3.10.0+e3465d0-44
kubernetes v1.10.0+b81c8f8
最佳答案
您的命令curl 172.17.0.6:8080
可以在 pods 内工作。
如果你想从你的终端(localhost)连接,你有以下方法:
oc port-forward <pod_name> 9999:8080
在另一个终端curl localhost:9999
, here命令引用 最快的调试方法是选项 1。
关于kubernetes - Pod 连接失败 - 从 pod 获取响应时操作超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52211034/