簡體   English   中英

Istio - 向路由/目的地添加前綴的方法?

[英]Istio - way to add prefix to route/destination?

目前已部署 Istio 來處理我的應用程序的入口。 遇到一個問題,需要通過某個 URL(例如“http://gateway/webapp1”)訪問一個應用程序,我需要它在內部路由到:server-name1:8080/some/odd/name/path

我目前的比賽聲明是:

  - match:
    - uri:
      prefix: /webapp1
  route:
    - destination:
        host: server-name1
        port:
          number: 8080

我無法弄清楚如何擴展目標路由以告訴它到達一個不同的端點,即 server-name1:8080。 有沒有一種簡單的方法可以為底層路由/目的地添加前綴? 謝謝你。

在進一步發送流量之前,您可以將HTTP 重寫與虛擬服務一起使用

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ratings-route
spec:
  hosts:
  - ratings.prod.svc.cluster.local
  http:
  - match:
    - uri:
        prefix: /webapp1
    rewrite:
      uri: /gateway/webapp1
    route:
    - destination:
        host: server-name1
        port:
          number: 8080

閱讀更多官方文檔: https ://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPRewrite

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM