管理 Apigee 入口閘道

從 Apigee Hybrid 1.8 版開始,Apigee Hybrid 會使用 Apigee Ingress 閘道,為 Hybrid 提供 Ingress 閘道。

設定 Apigee 進入閘道

您可以在 overrides.yaml 中設定 Ingress 閘道。例如:

語法

ingressGateways:
- name: INGRESS_NAME
  replicaCountMin: REPLICAS_MIN
  replicaCountMax: REPLICAS_MAX
  resources:
    requests:
      cpu: CPU_COUNT_REQ
      memory: MEMORY_REQ
    limits:
      cpu: CPU_COUNT_LIMIT
      memory: MEMORY_LIMIT
  svcAnnotations:  # optional.
    SVC_ANNOTATIONS_KEY: SVC_ANNOTATIONS_VALUE
  svcLoadBalancerIP: SVC_LOAD_BALANCER_IP # optional

範例

ingressGateways:
- name: prod1
  replicaCountMin: 2
  replicaCountMax: 100
  resources:
    requests:
      cpu: 1
      memory: 1Gi
    limits:
      cpu: 2
      memory: 2Gi
  svcAnnotations:  # optional. See Known issue 243599452.
    networking.gke.io/load-balancer-type: "Internal"
  svcLoadBalancerIP: 198.252.0.123 
  • INGRESS_NAME 是 Ingress 閘道部署作業的名稱。這個名稱必須符合下列規定:
    • 長度上限為 17 個半形字元
    • 只能包含小寫英數字元、「-」或「.」
    • 開頭為英數字元
    • 結尾為英數字元

    請參閱「設定屬性參考資料」一節中的 ingressGateways[].name

  • REPLICAS_MINREPLICAS_MAX:安裝中 Apigee Ingress 閘道的副本數量下限和上限。請參閱設定屬性參考資料中的 ingressGateways[].replicaCountMiningressGateways[].replicaCountMax
  • CPU_COUNT_REQMEMORY_REQ:安裝中每個 Apigee Ingress 閘道副本的 CPU 和記憶體要求。

    請參閱設定屬性參考資料中的 ingressGateways[].resources.requests.cpuingressGateways[].resources.requests.memory

  • CPU_COUNT_LIMITMEMORY_LIMIT:安裝中每個 Apigee Ingress 閘道副本的 CPU 和記憶體上限。

    請參閱「設定屬性參考資料」中的 ingressGateways[].resources.limits.cpuingressGateways[].resources.limits.memory

  • SVC_ANNOTATIONS_KEY SVC_ANNOTATIONS_VALUE (選用):

    這是鍵/值組合,可為預設 Ingress 服務提供註解。雲端平台會使用註解來協助設定混合式安裝作業,例如將負載平衡器類型設為內部或外部。例如:

    ingressGateways:
      svcAnnotations:
        networking.gke.io/load-balancer-type: "Internal"

    註解會因平台而異。如需必要和建議的註解,請參閱平台說明文件。

    請參閱設定屬性參考資料中的 ingressGateways[].svcAnnotations
  • SVC_LOAD_BALANCER_IP (選填)。在支援指定負載平衡器 IP 位址的平台上,系統會使用這個 IP 位址建立負載平衡器。在不允許指定負載平衡器 IP 位址的平台上,系統會忽略這項屬性。 請參閱設定屬性參考資料中的 ingressGateways[].svcLoadBalancerIP

套用 Apigee 輸入閘道設定

使用 apigeectl 將變更套用至機構範圍。

$APIGEECTL_HOME/apigeectl apply -f overrides/overrides.yaml --org

管理工作

Apigee Ingress 閘道的常見管理工作包括:

停止向 ASM 提供設定

升級至 Apigee Hybrid 1.8 版,並將流量遷移至 Apigee Ingress Gateway 後,您就可以停止向 Anthos Service Mesh 提供路由設定。

  1. 更新 Apigee 控制器,停止在 API 伺服器中更新 Anthos 服務網格 CR 物件。 在覆寫檔案中,設定:

    ao:
      args:
        disableIstioConfigInAPIServer: true
  2. 套用設定變更:

    $APIGEECTL_HOME/apigeectl init -f OVERRIDES_FILE
    

    詳情請參閱設定屬性參考資料中的 ao

  3. 由於上一個指令重新啟動了控制器,請使用下列指令檢查部署作業的狀態:
    $APIGEECTL_HOME/apigeectl check-ready -f OVERRIDES_FILE
  4. 更新 virtualhosts。每個虛擬主機都必須包含 app 選擇器標籤,且值為 app: apigee-ingressgateway。這項異動生效後,Anthos 服務網格閘道就無法讀取 Apigee 路由設定。

    在每個虛擬主機中新增或取代 selector 屬性,如下所示:

    virtualhosts:
    - name: ENV_GROUP
      selector:
        app: apigee-ingressgateway # required
      ...
    

    套用設定變更:

    $APIGEECTL_HOME/apigeectl apply -f OVERRIDES_FILE --settings virtualhosts
    

    詳情請參閱設定屬性參考資料中的「virtualhosts.selector」。

擴縮 Apigee Ingress 閘道:

在覆寫檔案中更新下列屬性。

  • ingressGateways[].replicaCountMax
  • ingressGateways[].replicaCountMin

詳情請參閱設定屬性參考資料中的 ingressGateways

使用 apigeectl apply --org 套用變更。

更新資源分配

在覆寫檔案中更新下列屬性。

  • ingressGateways[].resources.limits.cpu
  • ingressGateways[].resources.limits.memory
  • ingressGateways[].resources.requests.cpu
  • ingressGateways[].resources.requests.memory

詳情請參閱設定屬性參考資料中的 ingressGateways

使用 apigeectl apply --org 套用變更。

更新 Apigee Ingress 閘道服務

在覆寫檔案中更新下列屬性。

  • ingressGateways[].svcAnnotations
  • ingressGateways[].svcLoadBalancerIP

詳情請參閱設定屬性參考資料中的 ingressGateways

使用 apigeectl apply --org 套用變更。

停用預設 Apigee Ingress 閘道服務的負載平衡器:

如果您為 Ingress 閘道部署建立自訂 Kubernetes 服務,可以停用預設 Kubernetes 服務的負載平衡器建立作業。在覆寫檔案中,將 ingressGateways[].svcType 屬性更新為 ClusterIP。例如:

ingressGateways:
  - name: my-ingress-gateway
    replicaCountMin: 2
    replicaCountMax: 10
    svcType: ClusterIP

使用 apigeectl apply --org 套用變更。

設定 TLS 和 mTLS

請參閱「在 Ingress 閘道上設定 TLS 和 mTLS」。

啟用 non-SNI 用戶端

請參閱「啟用非 SNI 和 HTTP 用戶端」。

安裝其他 Apigee Ingress 閘道

您可以在 overrides.yaml 檔案中新增多個 Ingress 閘道。ingressGateways 設定屬性是陣列。詳情請參閱「設定屬性參考資料」中的 ingressGateways

例如:

ingressGateways:
- name: fruit
  replicaCountMin: 2
  replicaCountMax: 10

- name: meat
  replicaCountMin: 2
  replicaCountMax: 10

使用 apigeectl apply --org 套用變更。

將 Apigee Ingress 指定至虛擬主機

您可以在覆寫檔案中,將標示的 Apigee Ingress 閘道指定給特定虛擬主機。 這項設定會指定 Apigee 要套用虛擬主機設定的 Ingress 閘道。在下列範例中,虛擬主機 spam-vh 已設為使用標示為 meat 的 Ingress 閘道,其他兩個虛擬主機則使用 fruit Ingress 閘道。輸入閘道必須正確標示,如「安裝其他 Anthos 服務網格閘道」一文所述。

virtualhosts:
- name: spam-vh
  sslCertPath: cert-spam.crt
  sslKeyPath: cert-spam.key
  selector:
    app: apigee-ingressgateway
    ingress_name: meat
- name: banana-vh
  sslCertPath: cert-banana.crt
  sslKeyPath: cert-banana.key
  selector:
    app: apigee-ingressgateway
    ingress_name: fruit
- name: plum-vh
  sslCertPath: cert-plum.crt
  sslKeyPath: cert-plum.key
  selector:
    app: apigee-ingressgateway
    ingress_name: fruit

    

常見問題

如果我在其他命名空間中安裝了 Anthos 服務網格/Istio,這項功能會如何運作?
只要 Apigee 安裝在專屬命名空間中,Apigee Ingress 閘道就能與叢集中現有的 Anthos Service Mesh/Istio 安裝項目並行運作。Apigee Ingress 閘道不會在 apiserver 中儲存任何設定,因此不會發生任何衝突。
誰負責升級 Apigee Ingress 閘道元件?
Apigee 會負責升級 Apigee Ingress Gateway 元件,並在定期進行 Hybrid 升級和發布修補程式時執行這項作業。
如何在 Apigee Ingress 閘道中公開通訊埠 80?
Apigee Ingress 閘道不支援通訊埠 80。如果您要從 Anthos Service Mesh 遷移至 Apigee Ingress 閘道,並按照社群貼文中的操作說明啟用通訊埠 80,則無法搭配 Apigee Ingress 閘道使用。