Memantau Cluster Kubernetes: Ringkasan dan Pengantar Prometheus

Mari pertimbangkan konsep pemantauan Kubernetes, berkenalan dengan alat Prometheus, dan berbicara tentang peringatan.



Topik pemantauan sangat banyak, tidak dapat dibongkar dalam satu artikel. Tujuan teks ini adalah untuk memberikan gambaran umum tentang alat, konsep, dan pendekatan.



Materi artikel merupakan petikan dari kuliah terbuka sekolah Slurm . Jika Anda ingin menyelesaikan pelatihan lengkap, daftarlah ke kursus Pemantauan dan Logging Infrastruktur di Kubernetes .





Apa yang dipantau di cluster Kubernetes





Server fisik. Jika cluster Kubernetes di-deploy di server mereka, Anda perlu memantau kesehatannya. Tugas ini ditangani oleh Zabbix; jika Anda bekerja dengannya, maka Anda tidak perlu menolak, tidak akan ada konflik. Zabbixlah yang memantau status server kami.



Mari beralih ke pemantauan di tingkat cluster.



Komponen Control Plane: API, Scheduler dan lainnya. Minimal, Anda perlu memantau bahwa API server atau etcd lebih besar dari 0. Etcd dapat memberikan banyak metrik: pada disk tempat ia berputar, kesehatan cluster etcd-nya, dan lain-lain.



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