Add-on component to generate and expose OpenKruise metrics.
Go to file
Zhen Zhang a9d26e3451
update kruise-api to 1.8 (#24)
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2025-04-28 11:20:15 +08:00
.github/workflows update kruise-api to 1.8 (#24) 2025-04-28 11:20:15 +08:00
deploy Add metrics for ContainerRecreateRequest 2022-02-14 11:51:53 +08:00
docs Bump kruise-api to v.1.6.0; Fix typo; Fix panic metrics 2024-07-25 20:37:20 +08:00
examples add sample grafana dashboard 2023-01-31 13:19:33 +08:00
internal/store update kruise-api to 1.8 (#24) 2025-04-28 11:20:15 +08:00
pkg add sample grafana dashboard 2023-01-31 13:19:33 +08:00
.gitignore Add locally deploy and annotations metrics 2021-10-11 14:57:16 +08:00
.golangci.yml Fix golangci-lint errors 2022-02-14 11:56:22 +08:00
Dockerfile Upgrade kruise-api pkg to 1.7.1 (#23) 2025-04-27 20:18:36 +08:00
Dockerfile_multiarch Upgrade kruise-api pkg to 1.7.1 (#23) 2025-04-27 20:18:36 +08:00
LICENSE Initial commit 2021-07-22 14:12:55 +08:00
Makefile bump kustomize to v4@v4.5.2 2024-07-15 20:18:03 +08:00
README.md update kruise-api to 1.5.0 2024-01-23 21:01:53 +08:00
go.mod update kruise-api to 1.8 (#24) 2025-04-28 11:20:15 +08:00
go.sum update kruise-api to 1.8 (#24) 2025-04-28 11:20:15 +08:00
main.go add sample grafana dashboard 2023-01-31 13:19:33 +08:00

README.md

kruise-state-metrics

kruise-state-metrics is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects. (See examples in the Metrics section below.) It is not focused on the health of the individual OpenKruise components, but rather on the health of the various objects inside, such as clonesets, advanced statefulsets and sidecarsets.

kruise-state-metrics is about generating metrics from OpenKruise API objects without modification. This ensures that features provided by kruise-state-metrics have the same grade of stability as the OpenKruise API objects themselves. In turn, this means that kruise-state-metrics in certain situations may not show the exact same values as kubectl, as kubectl applies certain heuristics to display comprehensible messages. kruise-state-metrics exposes raw data unmodified from the Kubernetes API, this way users have all the data they require and perform heuristics as they see fit.

The metrics are exported on the HTTP endpoint /metrics on the listening port (default 8080). They are served as plaintext. They are designed to be consumed either by Prometheus itself or by a scraper that is compatible with scraping a Prometheus client endpoint. You can also open /metrics in a browser to see the raw metrics. Note that the metrics exposed on the /metrics endpoint reflect the current state of OpenKruise objects in the Kubernetes cluster. When the objects are deleted they are no longer visible on the /metrics endpoint.

Installation

Install with helm

kruise-state-metrics can be simply installed by helm v3.5+, which is a simple command-line tool and you can get it from here.

# Firstly add openkruise charts repository if you haven't do this.
$ helm repo add openkruise https://openkruise.github.io/charts/

# [Optional]
$ helm repo update

# Install the latest version.
$ helm install openkruise/kruise-state-metrics --version 0.1.0

Optional: download charts manually

If you have problem with connecting to https://openkruise.github.io/charts/ in production, you might need to download the chart from here manually and install or upgrade with it.

$ helm install/upgrade kruise-state-metrics /PATH/TO/CHART

Metrics Documentation

See the docs directory for more information on the exposed metrics.

Usage

See the examples directory for example grafana dashboard that use metrics exposed by kruise-state-metrics