What is it?
Monitoring and logging are two forms of usage metrics collection. Use monitoring on Kubernetes resources (such as Pods, Services, and nodes) to understand your resource consumption trends and to make decisions for scaling given an application.
The Kubernetes Metrics Server and Prometheus are two popular Kubernetes monitoring solutions:
- Metrics Server is a cluster-wide aggregator of resource usage data.
- Prometheus, now part of the Cloud Native Computing Foundation (CNCF), scrapes and exposes the resource usage from different Kubernetes components and objects, including your containerized application.
Read this blog post for details on monitoring in Kubernetes.
Use logging to troubleshoot and debug Kubernetes resources. Logging collects events in the form of logs outputted by application components. Kubernetes resources generate logs that can be collected, but it does not provide cluster-wide logging by default. Use third-party tools to centralize and aggregate these logs from the distributed components of Kubernetes.
The most common way to collect the logs is to use Elasticsearch, which uses fluentd with custom configuration as an agent on the nodes. Fluentd is an open-source data collector, which is also part of CNCF.
Why invest in it?
Metrics and logging provide the foundations for application and infrastructure level verification. I recommend looking into Observability concepts to build trusted and verified software solutions.