替服務通訊埠命名
如要納入 Cloud 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 控制台中,服務通訊埠必須使用下列其中一個通訊協定命名:http、http2 或 grpc。使用 https 通訊協定命名的服務通訊埠會視為 tcp,且系統不會顯示這些服務的指標。