端口名称不符合命名规范
当端口不遵循Istio 服务端口命名约定或端口未命名时,将出现此消息。
示例
您将收到此消息
Info [IST0118] (Service httpbin.default) Port name foo-http (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port.
当您的集群具有以下服务时
apiVersion: v1
kind: Service
metadata:
name: httpbin
labels:
app: httpbin
spec:
ports:
- name: foo-http
port: 8000
targetPort: 80
selector:
app: httpbin
在此示例中,端口名称 foo-http
不遵循语法:name: <protocol>[-<suffix>]
。
如何解决
- 如果您知道服务端口正在提供服务的协议,请使用
<protocol>[-<suffix>]
格式重命名端口; - 如果您不知道服务端口正在提供服务的协议,则需要从Prometheus 查询指标
- 运行查询
istio_requests_total{reporter="destination",destination_service_name="SERVICE_NAME",response_code="200"}[TIME_RANGE]
。如果您正在使用遥测指标覆盖,您还可以运行查询istio_requests_total{reporter="destination",destination_service_name="SERVICE_NAME",response_code="200",destination_port="TARGET_PORT"}[TIME_RANGE]
。 - 如果有输出,您可以从记录中找到
request_protocol
。例如,如果request_protocol
为“http”,则将端口重命名为“http-foo”; - 如果没有输出,您可以保留端口不变。
- 运行查询