为服务端口命名

要包含在 Anthos Service Mesh 中,服务端口必须命名,并且名称必须包含端口的协议,例如:

apiVersion: v1
kind: Service
metadata:
  name: ratings
  labels:
    app: ratings
    service: ratings
spec:
  ports:
  - port: 9080
    name: http

服务端口名称可以包含以下语法的后缀:name: protocol[-suffix],其中方括号表示必须以短划线开头的可选后缀,例如:

kind: Service
metadata:
  name: myservice
spec:
  ports:
  - number: 3306
    name: mysql
  - number: 80
    name: http-web

如需在 Google Cloud 控制台中显示指标,必须使用以下协议之一为服务端口命名:httphttp2grpc。使用 https 协议命名的服务端口被视为 tcp,因此对于这些服务,系统不会显示指标。