GatewayPortNotDefinedOnService

Message NameGatewayPortNotDefinedOnService
Message CodeIST0162
DescriptionGateway port not exposed by service
LevelWarning

This message occurs when a gateway (usually istio-ingressgateway) offers a port that the Kubernetes service workload selected by the gateway does not.

For example, your Istio configuration contains these values:

  1. # Gateway with bogus ports
  2. apiVersion: networking.istio.io/v1
  3. kind: Gateway
  4. metadata:
  5. name: istio-ingressgateway
  6. spec:
  7. selector:
  8. istio: ingressgateway
  9. servers:
  10. - port:
  11. number: 80
  12. name: http
  13. protocol: HTTP
  14. hosts:
  15. - "*"
  16. - port:
  17. number: 8004
  18. name: http2
  19. protocol: HTTP
  20. hosts:
  21. - "*"
  22. ---
  23. # Default Gateway Service
  24. apiVersion: v1
  25. kind: Service
  26. metadata:
  27. name: istio-ingressgateway
  28. spec:
  29. selector:
  30. istio: ingressgateway
  31. ports:
  32. - name: status-port
  33. port: 15021
  34. protocol: TCP
  35. targetPort: 15021
  36. - name: http2
  37. port: 80
  38. protocol: TCP
  39. targetPort: 8080
  40. - name: https
  41. port: 443
  42. protocol: TCP
  43. targetPort: 8443

In this example, the GatewayPortNotDefinedOnService message occurs because this configuration uses port 8004, but a default IngressGateway (named istio-ingressgateway) is only open on target ports 15021, 8080 and 8443.

To resolve this problem, change your gateway configuration to use a valid port on the workload and try again.

Here’s a corrected example:

  1. # Gateway with correct ports
  2. apiVersion: networking.istio.io/v1
  3. kind: Gateway
  4. metadata:
  5. name: istio-ingressgateway
  6. spec:
  7. selector:
  8. istio: ingressgateway
  9. servers:
  10. - port:
  11. number: 8080
  12. name: http2
  13. protocol: HTTP
  14. hosts:
  15. - "*"
  16. - port:
  17. number: 8443
  18. name: https
  19. protocol: HTTP
  20. hosts:
  21. - "*"