无法在Pod中连接 - 从pod获取响应时操作超时

问题描述 投票:1回答:1

下载文件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
kubernetes openshift openshift-client-tools
1个回答
1
投票

你的命令curl 172.17.0.6:8080可以在pod内部工作。

如果要从终端(localhost)进行连接,可以使用以下方法:

  1. oc port-forward <pod_name> 9999:8080和另一个终端curl localhost:9999here命令参考
  2. 设置ingress

最快的调试方法是选项1。

© www.soinside.com 2019 - 2024. All rights reserved.