kube-state-metrics/docs
Damien Grisonnet 229befd41d *: add webhooks client config service metrics
In order to better identify, prioritize, and debug webhook latency
issues it is important to have a metric that would point to the resource
it is responsible for.  However, it is not possible to have that
dimension in the metrics exposed by Kubernetes because of the unbound
cardinality that such a label would have.

The name of the webhook could be an alternative since it usually
contains some information about the resource that the webhook targets,
however this is not very practical to use in multi-tenants
environments.

A solution for these kind of platform is to tie a specific webhook to a
namespace in order to be able to know which tenant manages it and take
actions depending on that. This is achieveable by leveraging the client
config information of webhooks configured via WebhookConfiguration
resources since Services are namespaced objects.

With these new metrics, users will be able to split the alerting
severity of webhook latency / rejection rate per namespace on top of
being able to do it based on the webhook name. This is key in
environment where administrators don't have control over the webhooks
installed by the various tenants.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-07-04 18:20:34 +02:00
..
design docs: rename the Documentation folder to docs 2019-02-19 21:06:44 -08:00
developer Update docs/developer/guide.md 2022-12-21 09:34:40 -05:00
README.md feat!: Remove VerticalPodAutoscaler 2023-03-16 14:37:44 +01:00
certificatesigningrequest-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
cli-arguments.md update doc 2023-01-23 13:51:29 +01:00
clusterrole-metrics.md Fix typo 2022-06-30 20:55:28 +09:00
clusterrolebinding-metrics.md fix metrics name 2022-08-10 01:49:55 +09:00
configmap-metrics.md Expose configmap labels and annotations 2021-09-21 12:52:40 +03:00
cronjob-metrics.md Add missing LastSuccessfulTime metric 2022-05-16 18:38:41 +10:00
customresourcestate-metrics.md Add support for variable VKs in CRS config 2023-05-20 01:26:02 +05:30
daemonset-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
deployment-metrics.md Promote two metrics to stable 2022-08-30 20:51:29 -04:00
endpoint-metrics.md graduate new endpoint metrics to STABLE 2022-08-23 09:06:49 +02:00
endpointslice-metrics.md Add Metrics for EndpointSlices 2022-11-26 01:44:29 +01:00
horizontalpodautoscaler-metrics.md update(hpa): according to code review 2022-05-04 10:34:22 +02:00
ingress-metrics.md Add ingressclass to kube_ingress_info metric 2021-12-16 10:59:23 +11:00
ingressclass-metrics.md add stability experimental 2022-11-24 00:54:58 +09:00
job-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
lease-metrics.md Add namespace label to `kube_lease_renew_time` 2023-05-19 22:02:54 -05:00
limitrange-metrics.md Merge release-1.7 into upstream/master 2019-08-05 10:46:00 -07:00
mutatingwebhookconfiguration-metrics.md *: add webhooks client config service metrics 2023-07-04 18:20:34 +02:00
namespace-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
networkpolicy-metrics.md Add kube_*_annotations metrics 2021-04-29 16:04:16 +02:00
node-metrics.md docs: Fix typo in kube_node_deletion_timestamp description 2023-01-03 18:42:43 +01:00
persistentvolume-metrics.md Add host path metrics, fix table formatting 2022-08-24 11:17:08 +04:00
persistentvolumeclaim-metrics.md Replace special string "<none>" with empty string for "storageclass" dimension. 2022-12-03 15:20:08 +01:00
pod-metrics.md Clarify pod status in useful queries 2023-03-13 12:29:07 +00:00
poddisruptionbudget-metrics.md Implement kube_*_labels and kube_*_annotations metrics for pdb 2021-10-26 21:19:40 +05:30
replicaset-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
replicationcontroller-metrics.md Add kube_replicationcontroller_owner 2020-02-18 22:24:17 +01:00
resourcequota-metrics.md Merge release-1.7 into upstream/master 2019-08-05 10:46:00 -07:00
role-metrics.md add role and cluster role 2022-06-30 20:55:25 +09:00
rolebinding-metrics.md fix metrics name 2022-08-10 01:49:55 +09:00
secret-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
service-metrics.md Upgrade doc for service metrics of add uid 2022-02-20 00:36:28 +08:00
serviceaccount-metrics.md fix/docs: Typo correction in SA metrics 2022-09-19 15:19:34 +02:00
statefulset-metrics.md Add gauge implementation of kube_statefulset_ordinals_start 2023-03-13 12:11:51 -07:00
storageclass-metrics.md Mark new annotations metrics as EXPERIMENTAL 2021-08-15 18:11:36 +02:00
validatingwebhookconfiguration-metrics.md *: add webhooks client config service metrics 2023-07-04 18:20:34 +02:00
volumeattachment-metrics.md volumeattachment: Fix instrumentation guideline violation 2020-04-08 10:55:33 +02:00

README.md

Documentation

This documentation is intended to be a complete reflection of the current state of the exposed metrics of kube-state-metrics.

Any contribution to improving this documentation or adding sample usages will be appreciated.

Table of Contents

Metrics Stages

Stages about metrics are grouped into three categories

Stage Description
EXPERIMENTAL Metrics which normally correspond to the Kubernetes API object alpha status or spec fields and can be changed at any time.
STABLE Metrics which should have very few backwards-incompatible changes outside of major version updates.
DEPRECATED Metrics which will be removed once the deprecation timeline is met.

Opt-in Metrics

As of v2.3.0, kube-state-metrics supports additional opt-in metrics via the CLI flag --metric-opt-in-list. See the metric documentation to identify which metrics need to be specified.

Exposed Metrics

Per group of metrics there is one file for each metrics. See each file for specific documentation about the exposed metrics:

Default Resources

Optional Resources

Join Metrics

When an additional, not provided by default label is needed, a Prometheus matching operator can be used to extend single metrics output.

This example adds label_release to the set of default labels of the kube_pod_status_ready metric and allows you select or group the metrics by Helm release label:

kube_pod_status_ready * on (namespace, pod) group_left(label_release) kube_pod_labels

Another useful example would be to query the memory usage of pods by its phase, such as Running:

sum(kube_pod_container_resource_requests{resource="memory"}) by (namespace, pod, node)
  * on (namespace, pod) group_left() (sum(kube_pod_status_phase{phase="Running"}) by (pod, namespace) == 1)

Metrics from Custom Resources

See Custom Resource State Metrics for experimental support for custom resources.

CLI Arguments

Additionally, options for kube-state-metrics can be passed when executing as a CLI, or in a kubernetes / openshift environment. More information can be found here: CLI Arguments