修改Service配置

kind: Service
apiVersion: v1
metadata:
  name: user-admin-svc
  labels:
    app: user-admin-svc
    micrometer-prometheus-discovery: 'true'
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: >
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"kubesphere.io/alias-name":"用户管理服务","kubesphere.io/description":"用户管理服务"},"name":"user-admin-svc","namespace":"dw-test"},"spec":{"ports":[{"name":"tcp-8080","port":8080,"protocol":"TCP","targetPort":8080}],"selector":{"app":"user-admin"},"type":"NodePort"}}
    kubesphere.io/alias-name: 用户管理服务
    kubesphere.io/description: 用户管理服务
    prometheus.io/path: /actuator/prometheus
    prometheus.io/port: '50000'
    prometheus.io/scrape: 'true'
spec:
  ports:
    - name: tcp-8080
      protocol: TCP
      port: 8080
      targetPort: 8080
      nodePort: 30010
  selector:
    app: user-admin

配置修改汇总

  • 添加服务发现注释 micrometer-prometheus-discoveryprometheus.io/portprometheus.io/pathprometheus.io/scrape
作者:Jeebiz  创建时间:2023-02-18 21:51
最后编辑:Jeebiz  更新时间:2024-08-02 14:28