Repolode
kubernetes

kubernetes/kube-state-metrics

An add-on Kubernetes service that listens to the API server and exposes Prometheus metrics describing the state of objects like pods, deployments and nodes.

Stars
6,228
Forks
2,199
Open issues
117
Last commit
5 days ago

What is it?

kube-state-metrics (KSM) watches the Kubernetes API server and generates metrics about the state of objects such as deployments, nodes and pods. It focuses on the health of the objects inside a cluster rather than the internal health of Kubernetes components, and it exposes raw data from the API without applying the heuristics kubectl uses for display.

Metrics are served as plaintext on the HTTP /metrics endpoint, designed to be scraped by Prometheus or a compatible scraper. The metrics reflect the current cluster state, so deleted objects disappear from the output. Resource usage scales with cluster size, and the project provides guidance on sharding, resource filtering and limiting access through RBAC for large or restricted environments.

The project is maintained under SIG Instrumentation, and the official Helm chart is maintained in the prometheus-community helm-charts repository.

Key features

  • 01Generates metrics from Kubernetes API objects without modification.
  • 02Exposes metrics on an HTTP /metrics endpoint in Prometheus format.
  • 03Supports horizontal sharding by object UID or automated sharding via StatefulSet.
  • 04Allows filtering scraped resources with resources and exclude_resources query parameters.
  • 05Converts Kubernetes labels into Prometheus labels, resolving naming conflicts with suffixes.
  • 06Provides health endpoints /healthz, /livez and /readyz.

Use cases

  • Building Prometheus dashboards and alerts on deployment replica counts, pod phases or node conditions.
  • Monitoring workload health across a cluster without changing the applications running in it.
  • Splitting metric collection across multiple instances when a single cluster produces large metric volumes.

Quick start

  1. 1

    Pull the container image from registry.k8s.io

  2. 2

    Deploy it to your cluster using the Kubernetes Deployment or Helm Chart instructions in the README

Things to know

  • It only runs inside a Kubernetes cluster and needs API server access.
  • It keeps a full snapshot of cluster state in memory, so it needs about 250MiB memory and 0.1 cores per general guidance.
  • Default event metrics can generate high ingestion costs on some cloud providers.
  • The custom-resource-state feature is frozen in favor of resource-state-metrics.

In collections

Topics

FAQ

What is kube-state-metrics?
An add-on Kubernetes service that listens to the API server and exposes Prometheus metrics describing the state of objects like pods, deployments and nodes. kube-state-metrics (KSM) watches the Kubernetes API server and generates metrics about the state of objects such as deployments, nodes and pods. It focuses on the health of the objects inside a cluster rather than the internal health of Kubernetes components, and it exposes raw data from the API without applying the heuristics kubectl uses for display.
Is kube-state-metrics free to use? What license does it have?
kube-state-metrics is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is kube-state-metrics still maintained?
Actively maintained. The last commit to kube-state-metrics was on Oct 19, 2026.
What can I use kube-state-metrics for?
Building Prometheus dashboards and alerts on deployment replica counts, pod phases or node conditions. Monitoring workload health across a cluster without changing the applications running in it. Splitting metric collection across multiple instances when a single cluster produces large metric volumes.
How do I install kube-state-metrics?
Pull the container image from registry.k8s.io Deploy it to your cluster using the Kubernetes Deployment or Helm Chart instructions in the README
Where can I get kube-state-metrics?
The source code and installation instructions are on GitHub: https://github.com/kubernetes/kube-state-metrics

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects