如何将CNAME指向OpenShift路由



我在OpenShift上托管的应用程序有一个URL的路由,看起来像这样:

https://books-student-book-reservation-backend-project.apps.amarige.hostname.us

我想给最终用户一个URL,看起来像这样:https://breeze.us。首先,它隐藏了OpenShift URL结构,其次,它更容易记住。最重要的是,它更用户友好。

挑战在于当我重定向微风时。我们到OpenShift路线,我得到"应用程序不可用";

对于如何解决这个问题有什么建议吗?

https://docs.openshift.com/online/pro/dev_guide/routes.html#custom-route-and-hosts-and-certificates-restrictions

如果你正在使用OpenShift Online

在OpenShift Online Starter中,不允许自定义主机名。你可以购买OpenShift Online Pro(它允许设置自定义主机名),或者使用反向代理将你的流量(从另一个具有自定义主机名的服务器)重定向到OpenShift。

如果使用自部署的OKD

你可以为你的路由设置自定义主机名,如下所示:

# A example unsecured route with custom hostname
apiVersion: v1
kind: Route
metadata:
name: route-unsecured
spec:
host: www.your-custom-hostname.com  # here
to:
kind: Service
name: service-name

如果你需要在相同的主机名下提供多条路由,你也可以使用自定义主机名做基于路径的路由:

# A example unsecured path-based route with custom hostname
apiVersion: v1
kind: Route
metadata:
name: route-unsecured
spec:
host: www.your-custom-hostname.com
path: "/test"      # here
to:
kind: Service
name: service-name

使您可以使用www.your-custom-hostname.com/test访问您的路由。