Monitoring and Logging External Services in Kubernetes - Habr
Monitoring and Logging External Services in Kubernetes - Habr
All streams Development Administrating Design Management Marketing PopSci Log in Sign up
Greetings to all!
As a matter of fact I haven't found so far any generalized guide on logging and monitoring of metrics from external systems to
Kubernetes on the web. Here I want to share with you my own version. First of all it is supposed that you have already got working
Prometheus and other services.
As an example I use third-party data for stateful service RDBMS PostgreSQL in a Docker container. In our company we also use the Helm
package manager, and you'll find how it works below. You can see same examples in this article below. You can see same examples in
this article below. For a complete solution we create a nested chart.
Logging
Many companies use ELK stack for centralized logging (Elasticsearch + Logstash + kibana). In our case we don't need to index the
content and I apply lightweight Loki. It is available and can be installed as a Helm package. We added it as subchart having changed
values for ingress & pv.
values.yaml
We use Loki Docker Logging Driver for log sending to instance Loki.
You have to set it up as a Docker plugin on all hosts from which you want to get logs. There are several ways to use plugin. My choice is
to put it in the yaml file of Docker Compose which is a part of Ansible playbook.
postgres.yaml
Metrics
PostgreSQL metrics are collected to Prometheus with a postgres_exporter. See extension of Ansible playbook file below.
postgres.yaml
For better clarity the names of external stateful services are presented with Endpoints.
postgres-service.yaml
https://habr.com/en/post/506278/ 1/3
8/15/2020 Monitoring and Logging external services in Kubernetes / Habr
Prometheus settings for getting data from postgres_exporter are tuned by means of value editing in the subchart.
values.yaml
For visualisation of data install a proper dashboard for Grafana and add datasource. That can be done with values of Grafana subchart.
See how it looks below.
How it looks
I hope my first brief article in English will help you to understand basic ideas of this solution and save your time when adjusting
monitoring and logging procedures of external services in Loki/Prometheus in Kubernetes.
14.0 0.0
Karma Rating
@ alexovchinnicov
Пользователь
SIMILAR POSTS
Monitoring System for Windows servers on pure SQL, and how I had secretly dragged it into the Production
+20 837 1 0
About monitoring
+12 1.8k 3 3
Ads
Comments 0
Only users with full accounts can post comments. Log in, please.
TOP POSTS
https://habr.com/en/post/506278/ 2/3
8/15/2020 Monitoring and Logging external services in Kubernetes / Habr
TOP POSTS
Audio over Bluetooth: most detailed information about profiles, codecs, and devices
+22 112k 10 8
Terms of service
https://habr.com/en/post/506278/ 3/3