【发布时间】:2018-02-09 17:12:15
【问题描述】:
我的用例需要直通 SSL,因此我们不能在 Openshift 中原生使用基于路径的路由。我们的下一个最佳解决方案是设置一个内部 NGINX 代理,将流量从一个路径路由到另一个 Web UI 的 Openshift 路由。这样做时我遇到了错误。
这是我简化的 NGINX 配置:
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /etc/nginx/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
upstream app1-ui-1-0 {
server app1-1-0.192.168.99.100.nip.io:443;
}
server {
listen 8443 ssl default_server;
location /apps/app1/ {
proxy_pass https://app1-ui-1-0/;
}
}
}
我的app1路由配置如下:
apiVersion: v1
kind: Route
metadata:
name: app1-1-0
spec:
host: app1-1-0.192.168.99.100.nip.io
to:
kind: Service
name: app1-1-0
tls:
insecureEdgeTerminationPolicy: Redirect
termination: passthrough
当我点击
https://app1-1-0.192.168.99.100.nip.io时,应用程序运行良好。当我点击 NGINX 代理路由 url (
https://proxier-1-0.192.168.99.100.nip.io) 时,它会正确加载 nginx 的标准 index.html 位置。-
但是,当我尝试通过代理通过
https://proxier-1-0.192.168.99.100.nip.io/apps/apps1/访问 app1 时,我收到以下 Openshift 错误:Application is not available The application is currently not serving requests at this endpoint. It may not have been started or is still starting.
通过日志和测试,我知道请求正在进入/apps/app1/ 位置块,但它永远不会到达 app1 的 NGINX。我还确认此错误来自 app1 的路由器或服务,但我不知道如何排除故障,因为两者都没有日志。有什么想法吗?
【问题讨论】:
-
为什么使用路由而不是内部dns?
-
是的,你是个天才。我删除了路由并直接通过内部 DNS 引用了该服务,它运行良好。谢谢!
-
很高兴它有帮助,发布更详细的解释,以防其他人点击此
-
我遇到了同样的问题,但我不知道我可以使用下面发布的解决方案,因为我的 Nginx 服务器位于一个 Openshfit 集群中,而代理服务器位于另一个集群中。是否有使用 TLS 直通路由的解决方案?
标签: nginx proxy routes openshift