排解 GKE Ingress 問題


本頁面說明如何解決 Google Kubernetes Engine (GKE) 中與 Ingress 相關的問題。

如需其他協助,請與 Cloud Customer Care 團隊聯絡。

Ingress 類別的註解不正確

症狀

建立 Ingress 時,您可能會看到下列錯誤:

Missing one or more resources. If resource creation takes longer than expected, you might have an invalid configuration.

可能原因

建立 Ingress 時,您可能在資訊清單中錯誤設定 Ingress 類別。

解決方法

如要指定 Ingress 類別,必須使用 kubernetes.io/ingress.class 註解。您無法使用 spec.ingressClassName 指定 GKE Ingress。

  • 如要部署內部應用程式負載平衡器,請使用 kubernetes.io/ingress.class: gce-internal 註解。
  • 如要部署外部應用程式負載平衡器,請使用 kubernetes.io/ingress.class: gce 註解。

靜態 IP 位址的註解不正確

症狀

設定外部 Ingress 使用靜態 IP 位址時,可能會看到下列錯誤:

Error syncing to GCP: error running load balancer syncing routine: loadbalancer <Name of load balancer> does not exist: the given static IP name <Static IP> doesn't translate to an existing static IP.

可能原因

  • 您在部署 Ingress 前,未建立靜態外部 IP 位址。
  • 您使用的註解不適用於負載平衡器類型。

解決方法

如要設定外部 Ingress:

  • 部署 Ingress 前,請先保留靜態外部 IP 位址
  • 在 Ingress 資源上使用 kubernetes.io/ingress.global-static-ip-name 註解。

如要設定內部 Ingress,請按照下列步驟操作:

  • 部署 Ingress 前,請先保留區域靜態內部 IP 位址。
  • 在 Ingress 資源上使用 kubernetes.io/ingress.regional-static-ip-name 註解。

靜態 IP 位址已在使用中

症狀

指定靜態 IP 位址來佈建內部或外部 Ingress 資源時,可能會看到下列錯誤:

Error syncing to GCP: error running load balancer syncing
routine: loadbalancer <LB name> does not exist:
googleapi: Error 409: IP_IN_USE_BY_ANOTHER_RESOURCE - IP ''<IP address>'' is already being used by another resource.

可能原因

靜態 IP 位址已由其他資源使用。

停用 HTTP 並使用 Google 代管的憑證時發生錯誤

症狀

如果您要設定 Google 管理的 SSL 憑證,並在 Ingress 上停用 HTTP 流量,系統會顯示下列錯誤訊息:

Error syncing to GCP: error running load balancer syncing
routine: loadbalancer <Load Balancer name> does not exist:
googleapi: Error 404: The resource ''projects/<Project>/global/sslPolicies/<Policy name>' was not found, notFound

可能原因

設定 Ingress 時,您無法同時使用下列註解:

  • networking.gke.io/managed-certificates (將 Google 代管的憑證與 Ingress 建立關聯)
  • kubernetes.io/ingress.allow-http: false (停用 HTTP 流量)

解決方法

外部應用程式負載平衡器完成程式設計後,才能停用 HTTP 流量。您可以更新 Ingress,並在資訊清單中新增註解 kubernetes.io/ingress.allow-http: false

內部 Ingress 缺少 Proxy 專用子網路

症狀

為內部應用程式負載平衡器部署 Ingress 時,您可能會看到下列錯誤:

Error syncing to GCP: error running load balancer syncing routine:
loadbalancer <LB name> does not exist: googleapi: Error 400: Invalid value for field 'resource.target': 'https://www.googleapis.com/compute/v1/projects/<Project ID>/regions/<Region>/targetHttpsProxies/<Target proxy>'.
An active proxy-only subnetwork is required in the same region and VPC as
the forwarding rule.

可能原因

您在建立 Ingress 資源之前,並未建立僅限 Proxy 的子網路。內部應用程式負載平衡器必須使用 Proxy 專用子網路。

解決方法

部署內部 Ingress 之前,請建立僅限 Proxy 的子網路

SSL 憑證金鑰過大

症狀

如果負載平衡器的 SSL 憑證金鑰大小過大,您可能會看到下列錯誤訊息:

Error syncing to GCP: error running load balancer syncing routine: loadbalancer gky76k70-load-test-trillian-api-ingress-fliismmb does not exist: Cert creation failures - k8s2-cr-gky76k70-znz6o1pfu3tfrguy-f9be3a4abbe573f7 Error:googleapi: Error 400: The SSL key is too large., sslCertificateKeyTooLarge

可能原因

Google Cloud SSL 憑證金鑰的位元數上限為 2,048 位元。

解決方法

將 SSL 憑證金鑰大小縮減至 2,048 位元以下。

在標準層級中建立 Ingress 時發生錯誤

症狀

如果您在專案中部署 Ingress,且專案預設網路層級設為「標準」,系統會顯示下列錯誤訊息:

Error syncing to GCP: error running load balancer syncing routine: load balancer <LB Name> does not exist: googleapi: Error 400: STANDARD network tier (the project''s default network tier) is not supported: STANDARD network tier is not supported for global forwarding rule., badRequest

解決方法

將專案預設網路層級設為「進階」。

後續步驟