Review images

In this article, let’s discuss Metadata in Kubernetes and how it can be used to monitor system performance.

Metadata is a fancy word. It means “data used to describe other data”. Although this explanation may seem inadequate, metadata is actually particularly useful for container environments. When you face a complex system, if you can capture its metadata, categorize and organize it, it can help to get to the heart of the problem and solve the problem faster.

In the Kubernetes environment, metadata is not only an important tool for organizing container choreography among many services, machines, availability areas, and (in the future) cloud platforms, it is also a key tool for understanding these choreographs. Metadata can be used by other services running on top of the Kubernetes system to help you manage your application.

We’ll look at some examples below, but before we get there, let’s take a quick look at Kubernetes metadata.

Introduction to Metadata

Kubernetes has a lot of metadata in the form of “labels” or “annotations.” By design, “tags” are identifying metadata and “annotations” are non-identifying metadata. They are very simple key-value pairs that look something like this:

"Labels" : {" key1 ":" value1 ", "key2", "value2"}

Tags are not unique: You may see many objects in your environment with the same tags, and you may see one object with many tags.

When are we likely to use “tags”? Here are some examples. Note: Once you start using tabs, you’ll find lots of ways to use this feature!

  • Environment: Dev, Prod, Test, UAT

  • Customer: Cust A, Cust B, and Cust C

  • Tier: Frontend and Backend

  • Apps: CacheWeb, Database, Auth

In addition to custom “tags”, Kubernetes itself adds “tags” to the system that contain useful raw data. The default tags provide key identification information in the Kubernetes hierarchy: Pod, Service, Replication Controller, and Namespace.

Let metadata do its thing

Once you’ve spent a little time with Kubernetes, you’ll find that tags have a particularly powerful application that makes them essential:

Kubernetes’ “tags” allow you to easily switch between a “physical” view of your hosts and containers, and a “logical” view of your applications and microservices.

In essence, platforms like Kubernetes are designed to be choreographed to make optimal use of the underlying physical resources. This is a powerful way to use private or public cloud resources efficiently, and sometimes you need to visualize these physical resources. In reality, however, most of the time your first and foremost concern is the performance of your service.

But in the world of Kubernetes, achieving this high utilization means that containers of a service may be scattered all over the place. So how do you measure the performance of a service? This is where metadata comes in handy. Using Kubernetes metadata, you can gain insight into the performance of your service, regardless of the physical location of the underlying container.

There is a picture and there is a truth

Let’s look at an example to give you a concrete idea of this: application monitoring. Here I have deployed a small environment with three nodes in GKE. We will use the Sysdig Cloud here to visualize this environment. Below is a list of nodes – you can see that each hostname begins with “gke”. We can see some basic performance parameters: CPU, memory, network, etc.

Review images

Each host runs several containers. Click on the host to see the relevant container:

Review images

Just looking at the list of containers on a single host, I can’t see the responsibility structure of these objects. We can only guess roughly that some containers run Kubernetes services (e.g. Kube-ui) and others are application-specific (e.g. Javaapp.x).

Now, let’s use the metadata provided by Kubernetes to look at the system from an “application-centric” perspective. Let’s create a hierarchy of components based on “tags” in the following order:

Namespace -> Replication Controller -> Pod -> Container

This aggregates the containers at different levels based on the above “tags”. In the app UI below, this aggregation and hierarchy is represented by a gray grouped navigation bar. As you can see, we have a “namespace” named PROd with a set of “services” (” replication controllers “) under it. Each copy controller contains multiple pods, which in turn are made up of multiple containers.

Review images

In addition to organizing containers by “tags,” this view also aggregates metrics for related containers, making it easy to see performance details for individual “namespaces” or “replication controllers.”

In other words: with this meta-data-based aggregated view, you can monitor or troubleshoot services (at a high level), and only drill down to the host or container layer when necessary.

Let’s use this environment to do something else — use metadata to visualize these “services” and the topology of their interactions. Here you can see that our containers are organized as “services,” but at the same time the mapping allows you to see how these “services” relate to each other.

Review images

The boxes represent the “services” aggregated from the “containers” (the number in the upper right shows the number of containers contained), and the arrows represent the interactions between the “services” and their latency.

This view provides another logical, non-physical view that allows us to show how the components work together. It gives me a clear idea of the performance of the “service,” the interaction, and the underlying resource consumption (CPU in this case).

Metadata: Love, don’t let go

While this is a brief introduction to metadata, I hope it inspires you to take a moment to think about how it relates to your own systems and how you can leverage it. We’ve made a very simple example with it here — primarily applications and services — but you can imagine collecting metadata across applications, across environments, across software components, and across cloud providers when Kubernetes efficiently schedules resources, You can quickly assess performance differences in any part of your infrastructure (Slice).

Today we will talk about visualization of these resources, and in the next article we will talk about adaptive alerting based on metadata.

View pictures View pictures



Activity recommended

【CNUTCon global Container Technology Conference 】 Micro services, continuous integration, container cloud, big data, e-commerce, traditional industries, start-ups and other 12 topics, Docker, Kubernetes, Netflix, Mesos, CoreOS, Alibaba, JINGdong and other companies of the core technology of the site exclusive reveal. Containerization and microservitization, please read the original link.

Review images