coreweave/kube-state-metrics
forked from kubernetes/kube-state-metrics
Captured source
source ↗coreweave/kube-state-metrics
Description: Add-on agent to generate and expose cluster-level metrics.
License: Apache-2.0
Stars: 0
Forks: 0
Open issues: 0
Created: 2024-06-28T19:40:16Z
Pushed: 2024-06-29T00:03:54Z
Default branch: main
Fork: yes
Parent repository: kubernetes/kube-state-metrics
Archived: yes
README:
Overview
     
kube-state-metrics (KSM) 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 Kubernetes components, but rather on the health of the various objects inside, such as deployments, nodes and pods.
kube-state-metrics is about generating metrics from Kubernetes API objects without modification. This ensures that features provided by kube-state-metrics have the same grade of stability as the Kubernetes API objects themselves. In turn, this means that kube-state-metrics in certain situations may not show the exact same values as kubectl, as kubectl applies certain heuristics to display comprehensible messages. kube-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 the Kubernetes cluster. When Kubernetes objects are deleted they are no longer visible on the /metrics endpoint.
> [!NOTE] > This README is generated from a [template](./README.md.tpl). Please make your changes there and run make generate-template.
Table of Contents
- [Versioning](#versioning)
- [Kubernetes Version](#kubernetes-version)
- [Compatibility matrix](#compatibility-matrix)
- [Resource group version compatibility](#resource-group-version-compatibility)
- [Container Image](#container-image)
- [Metrics Documentation](#metrics-documentation)
- [Conflict resolution in label names](#conflict-resolution-in-label-names)
- [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
- [Resource recommendation](#resource-recommendation)
- [Latency](#latency)
- [A note on costing](#a-note-on-costing)
- [kube-state-metrics vs. metrics-server](#kube-state-metrics-vs-metrics-server)
- [Scaling kube-state-metrics](#scaling-kube-state-metrics)
- [Resource recommendation](#resource-recommendation)
- [Horizontal sharding](#horizontal-sharding)
- [Automated sharding](#automated-sharding)
- [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
- [Setup](#setup)
- [Building the Docker container](#building-the-docker-container)
- [Usage](#usage)
- [Kubernetes Deployment](#kubernetes-deployment)
- [Limited privileges environment](#limited-privileges-environment)
- [Helm Chart](#helm-chart)
- [Development](#development)
- [Developer Contributions](#developer-contributions)
- [Community](#community)
Versioning
Kubernetes Version
kube-state-metrics uses `client-go` to talk with Kubernetes clusters. The supported Kubernetes cluster version is determined by client-go. The compatibility matrix for client-go and Kubernetes cluster can be found here. All additional compatibility is only best effort, or happens to still/already be supported.
Compatibility matrix
At most, 5 kube-state-metrics and 5 kubernetes releases will be recorded below. Generally, it is recommended to use the latest release of kube-state-metrics. If you run a very recent version of Kubernetes, you might want to use an unreleased version to have the full range of supported resources. If you run an older version of Kubernetes, you might need to run an older version in order to have full support for all resources. Be aware, that the maintainers will only support the latest release. Older versions might be supported by interested users of the community.
| kube-state-metrics | Kubernetes client-go Version | |--------------------|:----------------------------:| | v2.8.2 | v1.26 | | v2.9.2 | v1.26 | | v2.10.1 | v1.27 | | v2.11.0 | v1.28 | | v2.12.0 | v1.29 | | main | v1.30 |
Resource group version compatibility
Resources in Kubernetes can evolve, i.e., the group version for a resource may change from alpha to beta and finally GA in different Kubernetes versions. For now, kube-state-metrics will only use the oldest API available in the latest release.
Container Image
The latest container image can be found at:
registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0(arch:amd64,arm,arm64,ppc64leands390x)- View all multi-architecture images at here
Metrics Documentation
Any resources and metrics based on alpha Kubernetes APIs are excluded from any stability guarantee, which may be changed at any given release.
See the [docs](docs) directory for more information on the exposed metrics.
Conflict…
Excerpt shown — open the source for the full document.