Kubernetes Core Concepts: Kube State Metrics and Metrics Server

3 min readNov 7


Kubernetes provides a simple metrics server for CPU and memory usage for each pod and node.

Photo by Luke Chesser on Unsplash

Additionally, the Prometheus community has developed an improved version of the metrics server: Kube State Metrics

Now, the combination of these two is like the Swiss Army Knife.

Installing the Metrics Server

You can easily set up the metrics server via Helm. First add the helm repository of the metrics server;

helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm repo update

and install the metrics server:

helm upgrade --install --set replicas=2 metrics-server metrics-server/metrics-server

Make sure it is installed:

The metrics server was set up with two replica pods.

After this step, wait a few minutes for the metrics server to collect CPU and memory statistics from the sources (pods, nodes).

You can view metrics through kubectl top pods or kubectl top nodes

You can also access metrics via HTTP:

You can find other available endpoints on the metrics server here.

We can access the Metrics server endpoint via kube-proxy

Open the Metrics server endpoint in your browser:

Prometheus community developed Kube Health Metrics because the metrics server provides simple metrics

You may install the Kube State Metrics via Helm easily. First, add the Kube State Metrics’ helm repository;

You can easily install Kube State Metrics via Helm. First add the helm repository of the Kube State Metrics;

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

and install Kube State Metrics:

helm upgrade --install --set replicaCount=2 kube-state-metrics prometheus-community/kube-state-metrics

Get the domain of the kube-state-metrics server:

Go into one of the pods in your cluster and get the Kube State Metrics:

I filtered the pod from the metrics.

Kube State Metrics are actually raw data from the Kubernetes API.

Prometheus/Grafana makes this data readable and queryable.

However, you can benefit from metrics without needing an additional library.

I will scale out the web-debug deployment from 2 to 3 and try to observe the change in the metrics: