监控Kubernetes集群:Prometheus概述和介绍

让我们考虑监视Kubernetes的概念,熟悉Prometheus工具,并讨论警报。



监视主题非常多,不能一概而论。本文的目的是提供工具,概念和方法的概述。



本文的内容摘自Slurm学校的公开演讲如果您想完成全部培训,请注册Kubernetes中的“监视和日志记录基础结构”课程





Kubernetes集群中受监视的内容





物理服务器。如果在其服务器上部署了Kubernetes集群,则需要监视其运行状况。该任务由Zabbix处理;如果您与他一起工作,那么您不需要拒绝,就不会有冲突。是Zabbix监视我们服务器的状态。



让我们继续进行集群级别的监视。



控制平面组件: API,调度程序和其他。至少,您需要监视服务器或etcd的API是否大于0。Etcd能够提供许多指标:在其旋转的磁盘上,其etcd集群的运行状况以及其他方面。



Docker : . Docker, , , .



DNS. DNS, Discovery, . , , DNS . CoreDNS.



Ingress. ( Ingress Controller) .



— , .



, , , . : , ; 10, 2. . . , : -? , , — . .



, -: , .



Prometheus



Prometheus. , Prometheus . , « Kubernetes», Prometheus.



, Prometheus: Helm Prometheus Prometheus Operator.



  1. Prometheus. , ConfigMap — , , , .
  2. Prometheus Operator , , : , , .


, Prometheus. , : , . Prometheus Operator , .



Prometheus Kubernetes: API Server .



Prometheus , . , Prometheus , , . . , PostgreSQL Exporter: PostgreSQL Prometheus, Prometheus .



Prometheus





Prometheus Server — , Prometheus. .



time series database (TSDB). TSDB — , Go, Prometheus. , .



TSDB



Prometheus . 15 . , : TSDB , . Prometheus .



, , . TSDB « », . , , InfluxDB, ClickHouse . ClickHouse.

Prometheus Server pull: , . : « API Server», n- .



(job cron job), , Pushgateway. : job , , Pushgateway . Prometheus Pushgateway.



Prometheus — Alertmanager. — alerting rules. , alert , API 0. , alert alert manager . alert manager : - , , . Slack, Telegram, email .



- Prometheus — Discovering. Prometheus , . « IP-, — », , (targets — ). Prometheus , , , .



Kubernetes, : 10 , 3. IP- , , — Discovering .



Prometheus PromQL. , .



https://prometheus.io/docs/prometheus/latest/querying/basics/

 

    container_memory_usage_bytes

 

    container_memory_usage_bytes / 1024 / 1024

 

    sum(container_memory_usage_bytes) / 1024 / 1024

 

    100 - avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m]) * 100)


- Prometheus



Prometheus , -. .





Expression PromQL.



Alerts — alerting rules, :



  1. inactive — , , ;
  2. pending — , , . , : , ;
  3. firing — , .


Status , Prometheus. (targets), .





Prometheus Kubernetes.



Grafana



- Prometheus , . , Prometheus Grafana. .





Prometheus Grafana , : GRAFANA SUPPORT FOR PROMETHEUS, .



: Grafana Loki .



: , Kubernetes, Southbridge, .




All Articles