mirror of https://github.com/istio/istio.io.git
1.7 KiB
1.7 KiB
| title | layout | owner | test |
|---|---|---|---|
| PortNameIsNotUnderNamingConvention | analysis-message | istio/wg-user-experience-maintainers | no |
当端口不遵循 Istio 服务端口命名约定或端口未命名时, 会出现此消息。
示例
您将收到这条消息:
{{< text plain >}} Info [IST0118] (Service httpbin.default) Port name foo-http (port: 80, targetPort: 80) doesn't follow the naming convention of Istio port. {{< /text >}}
当您的集群有以下 Service 时:
{{< text yaml >}} apiVersion: v1 kind: Service metadata: name: httpbin labels: app: httpbin spec: ports:
- name: foo-http port: 8000 targetPort: 80 selector: app: httpbin {{< /text >}}
在这个示例中,端口名 foo-http 不符合命名语法:name: <protocol>[-<suffix>]。
如何修复
- 如果您知道 Service 端口的协议,将端口重命名为
<protocol>[-<suffix>]格式就行; - 如果您不知道 Service 端口的协议,您需要从 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; - 如果没有输出,您可以将端口保持原样。
- 查询