一、查看创建的job已经添加完成
### --- 查看discovery是否生成
~~~ ——>http://prom.test.com/——>status
~~~ ——>Service discovery:auto_discovery已经创建完成,但是没有匹配到任何的targets
二、匹配一个域名让其监控
### --- 匹配一个域名让其监控
~~~ ——>http://krm.test.com——>Ingress——>Namespace:kube-system
~~~ ——>Host:krm.test.com——>Option:编辑——>annotations:
~~~ 添加:annotations:Key:prometheus.io/http_probe Value:true——>update——>END
~~~ # 若是域名定义了prometheus_io_http_probe这个annotations,
~~~ relabel_configs就可以匹配到,
~~~ 若是为true的话,它就会把这个target自动的给监控上,
[root@k8s-master01 discovery]# cat prometheus-additional.yaml
- source_labels: [__meta_kubernetes_ingress_annotation_prometheus_io_http_probe]
action: keep
regex: true
三、检测到targets值,并自动监控上:服务发现检测成功
四、查看grafana是否采集到数据
### --- 查看grafana是否采集到数据
~~~ http://krm.test.com/监控报红:是因为黑盒解析不了域名
~~~ 因为这个域名是我们配置了hosts解析