使用 F5 BIG-IP 負載平衡器,為 VMware 適用的 Google Distributed Cloud (僅限軟體) 設定外部 IP 位址

針對 VMware 的 Google Distributed Cloud (僅限軟體),預設的 Cloud Service Mesh 安裝作業會假設系統會自動為 LoadBalancer 服務分配外部 IP 位址。不過,如果 VMware 搭配 F5 BIG-IP 負載平衡器,則不適用於 Google Distributed Cloud (僅限軟體)。因此,您需要根據服務網格設定,分配一或多個外部 IP 位址:

  • Cloud Service Mesh 入口閘道資源的外部 IP 位址,例如客戶用於透過網際網路存取工作負載的閘道。
  • 如果叢集位於服務網格中的不同網路上,則可使用另一個外部 IP 位址進行通訊。這就是所謂的東西向閘道。

設定入口閘道 IP 位址

如要為輸入閘道設定外部 IP 位址,請根據您Google Distributed Cloud (僅限軟體) 的 VMware 負載平衡模式,按照下列任一節的操作說明進行:

    整合模式

  1. 使用入口閘道的外部 IP 位址修補 istio-ingressgateway 服務的設定:
    kubectl patch svc istio-ingressgateway -n istio-system --type='json' -p '[{"op": "add", "path": "/spec/loadBalancerIP", "value": "INGRESS_GATEWAY_IP"}]'
  2. 手動模式

  3. 在殼層中查看 istio-ingressgateway 服務的設定:
    kubectl get svc -n istio-system istio-ingressgateway -o yaml
    Cloud Service Mesh 的每個閘道通訊埠都會顯示。指令輸出內容如下所示:
      ...
      ports:
      - name: status-port
        nodePort: 30391
        port: 15020
        protocol: TCP
        targetPort: 15020
      - name: http2
        nodePort: 31380
        port: 80
        protocol: TCP
        targetPort: 80
      - name: https
        nodePort: 31390
        port: 443
        protocol: TCP
        targetPort: 443
      - name: tcp
        nodePort: 31400
        port: 31400
        protocol: TCP
        targetPort: 31400
      - name: https-kiali
        nodePort: 31073
        port: 15029
        protocol: TCP
        targetPort: 15029
      - name: https-prometheus
        nodePort: 30253
        port: 15030
        protocol: TCP
        targetPort: 15030
      - name: https-grafana
        nodePort: 30050
        port: 15031
        protocol: TCP
        targetPort: 15031
      - name: https-tracing
        nodePort: 31204
        port: 15032
        protocol: TCP
        targetPort: 15032
      - name: tls
        nodePort: 30158
        port: 15443
        protocol: TCP
        targetPort: 15443
      ...
  4. 透過負載平衡器公開這些連接埠。

    舉例來說,名為 http2 的服務通訊埠有 port 80 和 nodePort 31380。假設使用者叢集的節點位址為 192.168.0.10192.168.0.11192.168.0.12,而負載平衡器的 VIP 為 203.0.113.1

    請設定負載平衡器,將傳送至 203.0.113.1:80 的流量轉送至 192.168.0.10:31380192.168.0.11:31380192.168.0.12:31380。您可以選取要在這個指定 VIP 上公開的服務連接埠。

確認已為入口閘道指派外部 IP 位址。可能會稍微延遲,因此您可能需要重複執行這項指令,直到看到預期結果為止:

kubectl --context="${CTX_CLUSTER1}" get svc istio-ingressgateway -n istio-system

預期的輸出內容如下:

NAME                    TYPE           CLUSTER-IP    EXTERNAL-IP    PORT(S)   AGE
istio-ingressgateway   LoadBalancer   10.80.6.124   34.75.71.237   ...       51s

設定東西向閘道 IP 位址

如要為東西向閘道設定外部 IP 位址,請根據您VMware 負載平衡模式的 Google Distributed Cloud (僅限軟體),按照下列任一章節中的操作說明進行:

    整合模式

  1. 使用東西向閘道的外部 IP 位址修補 istio-eastwestgateway 服務的設定:
    kubectl patch svc istio-eastwestgateway -n istio-system --type='json' -p '[{"op": "add", "path": "/spec/loadBalancerIP", "value": "EAST_WEST_GATEWAY_IP"}]'
  2. 手動模式

  3. 在殼層中查看 istio-eastwestgateway 服務的設定:
    kubectl get svc -n istio-system istio-eastwestgateway -o yaml
    Cloud Service Mesh 的每個閘道通訊埠都會顯示。指令輸出內容如下所示:
      ports:
      - name: status-port
        nodePort: 31781
        port: 15021
        protocol: TCP
        targetPort: 15021
      - name: tls
        nodePort: 30498
        port: 15443
        protocol: TCP
        targetPort: 15443
      - name: tls-istiod
        nodePort: 30879
        port: 15012
        protocol: TCP
        targetPort: 15012
      - name: tls-webhook
        nodePort: 30336
        port: 15017
        protocol: TCP
        targetPort: 15017
      ...
  4. 透過負載平衡器公開這些連接埠。

    舉例來說,名為 http2 的服務通訊埠有 port 80 和 nodePort 31380。假設使用者叢集的節點位址為 192.168.0.10192.168.0.11192.168.0.12,而負載平衡器的 VIP 為 203.0.113.1

    請設定負載平衡器,將傳送至 203.0.113.1:80 的流量轉送至 192.168.0.10:31380192.168.0.11:31380192.168.0.12:31380。您可以選取要在這個指定 VIP 上公開的服務連接埠。

確認已為東西向閘道指派外部 IP 位址。可能會稍微延遲,因此您可能需要重複執行這個指令,直到看到預期結果為止:

kubectl --context="${CTX_CLUSTER1}" get svc istio-eastwestgateway -n istio-system

預期的輸出內容如下:

NAME                    TYPE           CLUSTER-IP    EXTERNAL-IP    PORT(S)   AGE
istio-eastwestgateway   LoadBalancer   10.80.6.124   34.75.71.237   ...       51s

後續步驟