|
1 | 1 | # Overview |
2 | 2 |
|
3 | | -kube-state-metrics generates metrics about the state of the object inside of a |
4 | | -Kubernetes cluster. It is not focused on the health of the Kubernetes |
5 | | -components individually, but rather on the health of the various objects |
6 | | -inside, such as deployments, nodes and pods. |
| 3 | +kube-state-metrics is a simple service that listens to the Kubernetes API |
| 4 | +server and generates metrics about the state of the objects. (See examples in |
| 5 | +the Metrics section below.) It is not focused on the health of the individual |
| 6 | +Kubernetes components, but rather on the health of the various objects inside, |
| 7 | +such as deployments, nodes and pods. |
| 8 | + |
| 9 | +The metrics are exported through the [Prometheus golang |
| 10 | +client](https://github.com/prometheus/client_golang) on the HTTP endpoint `/metrics` on |
| 11 | +the listening port (default 80). They are served either as plaintext or |
| 12 | +protobuf depending on the `Accept` header. They are designed to be consumed |
| 13 | +either by Prometheus itself or by a scraper that is compatible with scraping |
| 14 | +a Prometheus client endpoint. You can also open `/metrics` in a browser to see |
| 15 | +the raw metrics. |
7 | 16 |
|
8 | 17 | *Requires Kubernetes 1.2+* |
9 | 18 |
|
10 | | -# Usage |
11 | | - |
12 | | -Simply build and run kube-state-metrics inside a Kubernetes pod which has a |
13 | | -service account token that has read-only access to the Kubernetes cluster. |
14 | | - |
15 | 19 | ## Metrics |
16 | 20 |
|
17 | 21 | There are many more metrics we could report, but this first pass is focused on |
18 | | -those that could result in actionable alerts. Please contribute PR's for |
| 22 | +those that could be used for actionable alerts. Please contribute PR's for |
19 | 23 | additional metrics! |
20 | 24 |
|
21 | 25 | ### WARNING: THESE METRIC/TAG NAMES ARE UNSTABLE AND MAY CHANGE IN A FUTURE RELEASE. |
22 | 26 |
|
23 | | -* nodes ready=<true|false> |
24 | | -* deployment_replicas name=<deployment-name> namespace=<deployment-namespace> |
25 | | -* deployment_replicas_available name=<deployment-name> namespace=<deployment-namespace> |
26 | | -* container_restarts name=<container-name> namespace=<pod-namespace> pod_name=<pod-name> |
| 27 | +| Metric name | Labels/tags | |
| 28 | +| ------------- | ------------- | |
| 29 | +| nodes | ready=<true|false> | |
| 30 | +| deployment_replicas | name=<deployment-name> namespace=<deployment-namespace> | |
| 31 | +| deployment_replicas_available | name=<deployment-name> namespace=<deployment-namespace> | |
| 32 | +| container_restarts | name=<container-name> namespace=<pod-namespace> pod_name=<pod-name> | |
| 33 | + |
| 34 | +# Usage |
| 35 | + |
| 36 | +Simply build and run kube-state-metrics inside a Kubernetes pod which has a |
| 37 | +service account token that has read-only access to the Kubernetes cluster. |
27 | 38 |
|
28 | 39 | # Development |
29 | 40 |
|
30 | 41 | When developing, test a metric dump against your local Kubernetes cluster by running: |
31 | 42 |
|
32 | 43 | ``` |
33 | | -go run main.go --apiserver=<APISERVER-HERE> --in-cluster=false --port=<APISERVER-PORT> --dry-run |
| 44 | +go run main.go --apiserver=<APISERVER-HERE> --in-cluster=false --port=<APISERVER-PORT> --dry-run |
34 | 45 | ``` |
0 commit comments