1 部署 consul
    https://github.com/hashicorp/consul
    https://developer.hashicorp.com/consul/docs/k8s/installation/install
    helm部署

    image.png

    2 Promethues 对接consul
    image.png

    image.png

    添加consul配置

    1. - job_name: 'consul-endpoints'
    2. consul_sd_configs:
    3. - server: "consul-server.infrastructure-test.svc:8500"
    4. services: []
    5. relabel_configs:
    6. - source_labels: [__meta_consul_tags]
    7. regex: 'consul'
    8. action: drop
    9. - regex: __meta_consul_service_metadata_(.+)
    10. action: labelmap
    11. - action: replace
    12. source_labels: [__address__]
    13. regex: (.*):(.*)
    14. replacement: $1
    15. target_label: instance

    image.png

    image.png