日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

【URI Path Matching】URI路徑匹配

對于接收的請求,HTTP規(guī)則根據(jù)請求URI選擇處理。虛擬服務支持URI路徑的精確匹配,前綴匹配與正則匹配規(guī)則。本文介紹如何配置URI路徑匹配。

前提條件

已完成準備工作,并部署helloworld服務和sleep服務。具體操作,請參見準備工作

操作步驟

  1. 驗證服務配置。

    1. 在ACK集群對應的KubeConfig環(huán)境下,執(zhí)行以下命令,進入sleep環(huán)境開啟bash。

      kubectl exec -it deploy/sleep -- sh
    2. 執(zhí)行以下命令, 向helloworld服務發(fā)送請求。

      curl helloworld:5000/hello

      預期輸出為以下兩者之一,helloworld-v1和helloworld-v2隨機響應。

      Hello version: v2, instance: helloworld-v2-7d48f6b995-6****
      Hello version: v1, instance: helloworld-v1-6986f64596-s****
  2. 使用istioctl工具,執(zhí)行以下命令,為helloworld服務開啟L7 Waypoint。

    istioctl x waypoint apply --service-account helloworld
  3. 使用以下內容,創(chuàng)建目標規(guī)則。具體操作,請參見管理目標規(guī)則

    apiVersion: networking.istio.io/v1beta1
    kind: DestinationRule
    metadata:
      name: helloworld
      namespace: default
    spec:
      host: helloworld
      subsets:
        - labels:
            version: v1
          name: v1
        - labels:
            version: v2
          name: v2
    
  4. 使用以下內容,創(chuàng)建虛擬服務,添加URI Path Matching配置。具體操作,請參見管理虛擬服務

    apiVersion: networking.istio.io/v1beta1
    kind: VirtualService
    metadata:
      name: helloworld-vs
      namespace: default
    spec:
      hosts:
        - helloworld
      http:
        - match:
            - uri:
                exact: /hello
          route:
            - destination:
                host: helloworld
                subset: v1
  5. 驗證配置是否生效。

    1. 在ACK集群對應的KubeConfig環(huán)境下,執(zhí)行以下命令,進入sleep環(huán)境開啟bash。

      kubectl exec -it deploy/sleep -- sh
    2. 執(zhí)行以下命令, 向helloworld服務的/hello路徑發(fā)送請求。

      curl helloworld:5000/hello

      預期輸出始終為以下結果,由helloworld-v1響應。

      Hello version: v1, instance: helloworld-v1-6986f64596-s****