OpenShift 路由可从 PAAS 外部访问,但不能从 PAAS 内部的客户端访问

OpenShift route accessible from outside the PAAS but not from a client inside the PAAS

在同一个 openshift 项目中,我在 POD1 中有一个应用程序 1 (APP1),在 POD2 中有另一个应用程序 (APP2)。
这两个应用程序都提供 REST API 服务。这 2 个应用程序可以使用 2 个不同的 openshift 路由访问。

从 PAAS (openshift) 外部访问这两个应用程序工作正常:意味着使用来自 PAAS 外部客户端的 openhsift 路由对 APP1/APP2 进行 CURL 工作。

但是当 POD1 中的 APP1 使用 APP2 的 openshift 路由将 POD2 中的 APP2 提供的 REST 服务作为目标时。失败了。
同样,使用 openshift 路由从 APP1 的容器(使用 oc rsh)向 APP2 执行 CURL 失败。

但是,如果 APP1 部署在该 PAAS 之外,则使用 open shift 路由对 APP2 的客户端调用是有效的。
同样,使用 openshift 路由对 APP2 执行 CURL 在 PAAS 外部运行良好。

此外,如果我使用服务 PAAS 内部 IP/PORT (10.224.x.y),这将解决问题。但是意味着要使用两个不同的地址,具体取决于我们是从 PAAS 内部还是外部定位 APP2。

所以问题是如何使 openshift 路由从 PAAS 内部和外部可见?

或者是否有其他方法可以共享 hostname/port 从 PAAS 内部和外部访问 APP2?

您可能想看看:

https://docs.openshift.com/container-platform/3.7/architecture/networking/networking.html

对于内部通信,使用服务名称就足够了(在您的情况下,使用 app2 中的 app1-svc 与 app1 通信)。 当您访问路线视图时,您可以找到您的服务名称 - "Routes To" 列显示服务名称。

这里详细解释了服务的工作原理和配置方式:

https://docs.openshift.com/container-platform/3.7/architecture/core_concepts/pods_and_services.html#services