ServiceEntryAddressesRequired

ServiceEntryprotocol 字段未设置或设置为 TCP 时,且未定义 addresses,就会出现此消息。

示例

您将收到此消息

Warning [IST0134] (ServiceEntry service-entry.default serviceentry.yaml:13) ServiceEntry addresses are required for this protocol.

当您的集群具有以下ServiceEntry,其中protocol未设置,且addresses缺失时

apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
  name: service-entry
  namespace: default
spec:
  hosts:
    - 'istio.io'
  exportTo:
    - "."
  ports:
    - number: 443
      name: https
  location: MESH_EXTERNAL
  resolution: DNS

此分析器的另一个示例是,当您拥有一个protocol: TCPaddresses缺失的ServiceEntry

apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
  name: service-entry
  namespace: default
spec:
  hosts:
    - 'istio.io'
  exportTo:
    - "."
  ports:
    - number: 443
      name: https
      protocol: TCP
  location: MESH_EXTERNAL
  resolution: DNS

如何解决

请确保在protocol未设置或设置为 TCP 时在您的ServiceEntry中设置addresses。如果未设置addresses,则ServiceEntry中定义的端口上的所有流量都将匹配,无论主机如何。