![4f5c9e9926f93ccd54ddf15f8a7185bb.png](https://i-blog.csdnimg.cn/blog_migrate/6a6b4658c725ef5984766bcdbdfe9375.jpeg)
在 Istio1.4 及以上版本中,可观测性指标的创建、交换和抓取的方式已经发生改变。
以下内容讲述了我如何配置 Prometheus Operator 资源以从 Istio1.6 中抓取指标和安装最新版的 Grafana 仪表盘。
ServiceMonitor
Prometheus Operator 比默认的 Prometheus 安装更加动态。它增加了一些 CRD 以动态和透明地重新配置 Prometheus 集群。
ServiceMonitor 资源对象用于描述需要抓取哪些 Service 中的 Pod。
在 Istio1.6 + 版本中,我们需要监控两种类型的资源:Istio 控制平面资源和 Istio 代理的数据平面资源。
为此,我们创建了 2 个不同的 ServiceMonitor:
控制平面
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: prometheus-oper-istio-controlplane
labels:
release: prometheus
spec:
jobLabel: istio
selector:
matchExpressions:
- {
key: istio, operator: In, values: [mixer,pilot,galley,cit