Articles
Article
Observability

Kubernetes Monitoring – What Is It and How Does It Work?

Containerization has become the standard approach to application delivery. It provides a lightweight, efficient, and consistent environment for developing and running applications. It is therefore no surprise that the growing popularity of containerization has also led to an increase in the scale and complexity of applications built using this technology. However, the growing adoption of containerization has created a need for comprehensive tools to support container management. Kubernetes (k8s) was developed in response to this demand, becoming a new standard for running, managing, and orchestrating containerized environments at scale. What exactly is Kubernetes, and how does it relate to monitoring and observability? You will find answers to these questions in this article.

What Is Kubernetes (k8s)?

Kubernetes is an open-source project currently developed under the Cloud Native Computing Foundation (CNCF). Its core version, commonly referred to as Vanilla Kubernetes, is freely available to everyone. The platform's open nature has led to the development of numerous distributions based on Vanilla Kubernetes, offering a wide range of extensions and additional features alongside its core functionality.

Today, Kubernetes can be deployed independently on your own infrastructure or purchased as a managed service from a public cloud provider.

The most popular managed Kubernetes services offered by public cloud providers include:

• Azure Kubernetes Service (AKS)

• Amazon Elastic Kubernetes Service (EKS)

• IBM Cloud Kubernetes Service

• Red Hat OpenShift

• Google Kubernetes Engine (GKE)

• Oracle Kubernetes Engine

There is also a wide range of self-managed Kubernetes distributions, including both community editions and commercial solutions, such as:

• Red Hat OpenShift Container Platform

• Rancher Kubernetes Engine

• Mirantis Kubernetes Engine

• VMware Tanzu Kubernetes Grid

Kubernetes has addressed many challenges associated with distributed environments, including speed, scalability, and resilience. However, it has also introduced additional complexity when it comes to managing application performance, gaining visibility into services, and detecting existing or potential problems.

As a result, monitoring – and increasingly, observability – has become an essential consideration when designing Kubernetes-based architectures.

Observability vs. Monitoring

Although observability and monitoring are closely related, it is important to understand that they are two distinct concepts.

Monitoring

Monitoring focuses on tracking specific metrics to detect potential problems. It is based on the assumption that problems can be anticipated before they occur.

Data collected through monitoring is typically analyzed without considering the broader context of the system. Put simply, monitoring helps determine whether a failure is likely to occur in an area where we expect it.

This approach has significant limitations in complex, rapidly changing environments, such as cloud-native architectures. Due to their dynamic nature and multiple layers, it is impossible to predict every type of problem that may arise.

According to a commonly used definition, monitoring is the process of collecting, analyzing, and using information to track progress towards achieving objectives and support management decisions. It focuses on observing specific indicators. Logging provides additional data, but this information is generally considered separately from the broader system context.

Observability

Observability makes it possible to understand the internal state of a system and how individual components affect the infrastructure as a whole. It helps determine whether a system is behaving as expected and, when anomalies are detected, identify their underlying causes.

In principle, observability relies on combining data from multiple sources and performing comprehensive analyses of system performance based on the relationships between that data.

It provides a much broader context than traditional monitoring, including the impact of application performance on business metrics. The more mature the observability approach, the more comprehensive the insight into application behavior.

Observability should be automated and autonomous. It should provide visibility across the entire environment, correlate information from different sources, and analyze it in a broader context. Artificial intelligence can play a particularly important role in achieving this, giving commercial observability platforms a significant advantage.

Observability can be defined as the ability to understand a system's internal state by analyzing the data it generates, such as metrics, logs, and traces. It helps teams investigate what is happening across multi-cloud environments, making it easier to identify and resolve the root causes of problems.

Kubernetes and Application Monitoring

The main challenges associated with Kubernetes monitoring stem from the platform's complexity, the dynamically changing application environment, and the large number of interconnected components used in microservices architectures.

Kubernetes introduces an additional layer between the underlying infrastructure (physical or virtual) and the services that enable applications to run. A single service can be distributed across multiple instances.

The containers on which applications are based are ephemeral by nature. They can move across the infrastructure as required. When problems occur, identifying their root causes can be difficult because the issue may originate at any of several different layers.

So how can we detect and resolve problems across large numbers of microservices running in ephemeral, short-lived containers?

Comprehensive Kubernetes monitoring provides visibility into all the layers and components responsible for running containerized applications, including:

Infrastructure

Kubernetes and the containers it runs operate on top of physical or virtual infrastructure. It is essential to understand how the underlying infrastructure affects the platform and the applications running on it.

Regardless of whether we use infrastructure managed by a public cloud provider or our own infrastructure, we need visibility into the resources available and how they are being utilized.

Platform

Monitoring the Kubernetes platform itself is essential. Issues occurring at the platform level can have a cascading impact on the performance and operation of hosted services and may even lead to service outages.

Kubernetes is deployed in the form of a cluster, which consists of:

1. Worker nodes that run containerized services.

2. Nodes hosting the control plane components responsible for managing the platform.

Monitoring must therefore cover the overall health and status of the cluster, as well as each individual node. Resource utilization and events occurring at the cluster level should also be continuously tracked.

Workloads

In Kubernetes, a workload consists of one or more pods. Each pod contains one or more containers. Workloads are managed by the platform and assigned to so-called namespaces.

Just as we need visibility into the overall health, status, and resource utilization of the cluster, we also need insight into the workloads running on it and their individual components.

This information helps determine whether workloads are starting correctly, operating as expected, and remaining stable. If they are not, monitoring data can help identify the reasons.

Tracking resource utilization against declared resource requests and limits also helps determine whether resources have been configured appropriately.

Allocating insufficient resources can cause various problems, such as CPU throttling or container restarts due to insufficient memory. On the other hand, overprovisioning can generate unnecessary costs, particularly in large-scale environments.

Applications

Kubernetes does not provide visibility into the internal state of applications. Even when the platform itself is operating without any apparent issues, an application may still malfunction or experience performance problems.

Applications are typically built using microservices or multi-tier architectures, consisting of multiple independent components that communicate with one another.

For this reason, it is essential to monitor their internal state, individual transactions, and all components involved in processing them.

The collected data provides the foundation for identifying where problems occur and determining their root causes.

What Should Kubernetes Monitoring Include?

A comprehensive Kubernetes monitoring solution should primarily include:

• Metrics collected from hosts, clusters and their nodes, workloads (pods and containers), and application services.

• Distributed traces that make it possible to track individual transactions across services.

• Logs generated by containerized services, as well as system logs.

• Kubernetes events providing information about activities and changes occurring within the platform.

Kubernetes Monitoring Tools

There are many solutions available for monitoring Kubernetes, ranging from web-based management consoles included with the platform to commercial monitoring and observability products.

These tools provide insight into the overall status and health of the platform and its workloads, as well as basic resource utilization data.

Examples include Kubernetes Dashboard and the OpenShift console.

Another option is to use open-source solutions. One of the most popular is Prometheus, which can be used to collect and store metrics and generate alerts.

Prometheus has effectively become the open-source standard for Kubernetes monitoring. It enables the collection of metrics exposed by the Kubernetes platform, application-level metrics, and many other types of data through its available integrations and extensions.

Prometheus is very often deployed alongside Grafana, a tool that enables users to visualize and analyze data from multiple sources, including Prometheus itself.

Solutions such as Fluent Bit and Fluentd can be used to collect and forward logs, which can then be stored in Elasticsearch or Loki. OpenTelemetry and Jaeger can support distributed tracing and transaction tracking.

There are also commercial observability platforms designed for comprehensive monitoring, eliminating the need to deploy and maintain multiple separate tools.

Their greatest advantage is the ability to consolidate data from different sources in one place, analyze the relationships between them, and understand their impact across individual infrastructure and application layers.

Dynatrace is an example of such a solution. In addition to consolidating observability data, Dynatrace optimizes anomaly detection and root cause analysis.

It also provides full-stack observability, taking into account business performance, end-user experience, and security.

Summary

Observability and monitoring play a crucial role in effectively monitoring, managing, and improving complex applications based on microservices architectures.

Kubernetes monitoring is not a straightforward task due to the platform's complexity, the dynamic nature of its environment, and the volume and diversity of data that needs to be analyzed.

When designing a monitoring strategy, it is important to consider multiple aspects and cover all relevant layers and components, without overlooking the applications themselves – an area that is often neglected.

There are many approaches and tools that can support Kubernetes monitoring, ranging from open-source solutions to comprehensive, dedicated commercial observability platforms.

In our upcoming articles, we will take a closer look at how Kubernetes works and explore different approaches to monitoring it using various solutions.

If you are interested in this topic or have any questions, simply get in touch with us.


In-house materials


Slawek Zarzecki

Article by Sławomir Zarzecki

Solution Architect

Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//
Observability and security for business resilience
//

Stay informed

Subscribe to our newsletter and get the latest articles, insights, and updates delivered straight to your inbox.