istio学习笔记(5)-prometheus配置改造

版权声明 本站原创文章 由 萌叔 发表 转载请注明 萌叔 | http://vearne.cc 1. 前言 警告:本文仅用于萌叔自己总结之用,对其它人而言可能毫无营养,没有阅读价值。 要让一个k8s + istio的集群真正能够在生产可用,我们需要考虑如下几类指标。 Node Metrics Container Resource Metrics Kubernetes API Server Etcd metrics Kube state-metrics 对于准备上集群的服务而言,我们会比较关注 服务所在容器的CPU、内存、网络流量、磁盘使用率等 业务指标:QPS、StatusCode、ErrorCode、请求延迟、缓存使用情况,连接池等 其中很大一部分其实都是标准指标,所有的服务都应该会有。另外istio已经对container的输入和输出流量进行了拦截,基于这些条件。萌叔希望达到如下效果 目标 通过prometheus的自动发现功能,发现并监控Container Resource Metrics 通过prometheus的自动发现功能,发现并监控envoy拦截到的部分指标 3)通过prometheus的自动发现功能,发现并监控app暴露的prometheus metrics 对于标准指标实现在grafana上的自动配置(生成Dashboard和Graph) 显然对于1)2)中的指标都是标准指标 2. 配置 根据参考资料4的说法 spec: template: metadata: annotations: prometheus.io/scrape: true # determines if a pod should be scraped. Set to true to enable scraping. prometheus.io/path: /metrics # determines the path to scrape metrics at. Defaults to /metrics. prometheus.io/port: 80 # determines the port to scrape metrics at. Defaults to 80. 服务本身如果想暴露自己的指标,可以通过在pod上增加注释prometheus.io/scrape prometheus.io/path prometheus.io/port。 但是实际使用中我发现注入了istio之后,这3项的值已经被修改为 ...

November 16, 2020 · 2 min