【问题标题】:How to route port based o specific path in Kubernetes如何在 Kubernetes 中根据特定路径路由端口
【发布时间】:2020-07-05 16:03:12
【问题描述】:

我有两个服务并使用端口转发将它们转发到本地主机的不同 prot 中。比如service1可以通过localhost:port1访问,service2可以通过localhost:port2访问。

在 service1 工作流程的某个时刻,在 service1 UI 中,会生成一个新链接,例如 "localhost:port1/_/path"。但它实际上适用于该链接的 service2 。我可以通过将 port1 更改为 port2 来访问然后链接,但我无法使用生成的链接进行访问。我的意思是我可以访问"localhost:port2/_/path",而不是由service1后端生成的“localhost:port1/_/path"。如果service1中存在path"_/path",我想做一个端口路由。我该怎么做?我阅读了入口文档和找不到端口路由示例。 谢谢!

【问题讨论】:

    标签: kubernetes routes portforwarding nginx-ingress


    【解决方案1】:

    您需要部署 nginx 入口控制器并设置基于路径的路由。请点击链接以供参考

    https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/ingress-path-matching.md

    【讨论】:

    • 谢谢!我通过配置 istio-ingress 网关解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-01
    • 1970-01-01
    相关资源
    最近更新 更多