下载文件 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
将在 Pod 内部工作。
如果要从终端(本地主机(进行连接,可以使用以下方法:
-
oc port-forward <pod_name> 9999:8080
和在另一个终端curl localhost:9999
,这里是命令参考 -
设置入口
最快的调试方法是选项 1。