GatewayPortNotDefinedOnService

このメッセージは、ゲートウェイ(通常はistio-ingressgateway)が、ゲートウェイによって選択されたKubernetesサービスワークロードが提供していないポートを提供する場合に発生します。

たとえば、Istioの設定に次の値が含まれているとします。

# Gateway with bogus ports

apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: istio-ingressgateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
  - port:
      number: 8004
      name: http2
      protocol: HTTP
    hosts:
    - "*"
---

# Default Gateway Service

apiVersion: v1
kind: Service
metadata:
  name: istio-ingressgateway
spec:
  selector:
    istio: ingressgateway
  ports:
  - name: status-port
    port: 15021
    protocol: TCP
    targetPort: 15021
  - name: http2
    port: 80
    protocol: TCP
    targetPort: 8080
  - name: https
    port: 443
    protocol: TCP
    targetPort: 8443

この例では、この設定がポート8004を使用しているのに、デフォルトのIngressGatewayistio-ingressgateway)がターゲットポート15021、8080、8443でのみ開かれているため、GatewayPortNotDefinedOnServiceメッセージが発生します。

この問題を解決するには、ワークロードで有効なポートを使用するようにゲートウェイ設定を変更して、再試行してください。

修正された例を以下に示します。

# Gateway with correct ports

apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: istio-ingressgateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 8080
      name: http2
      protocol: HTTP
    hosts:
    - "*"
  - port:
      number: 8443
      name: https
      protocol: HTTP
    hosts:
    - "*"