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> |
||
|---|---|---|
| .. | ||
| design | ||
| developer | ||
| README.md | ||
| certificatesigningrequest-metrics.md | ||
| cli-arguments.md | ||
| clusterrole-metrics.md | ||
| clusterrolebinding-metrics.md | ||
| configmap-metrics.md | ||
| cronjob-metrics.md | ||
| customresourcestate-metrics.md | ||
| daemonset-metrics.md | ||
| deployment-metrics.md | ||
| endpoint-metrics.md | ||
| endpointslice-metrics.md | ||
| horizontalpodautoscaler-metrics.md | ||
| ingress-metrics.md | ||
| ingressclass-metrics.md | ||
| job-metrics.md | ||
| lease-metrics.md | ||
| limitrange-metrics.md | ||
| mutatingwebhookconfiguration-metrics.md | ||
| namespace-metrics.md | ||
| networkpolicy-metrics.md | ||
| node-metrics.md | ||
| persistentvolume-metrics.md | ||
| persistentvolumeclaim-metrics.md | ||
| pod-metrics.md | ||
| poddisruptionbudget-metrics.md | ||
| replicaset-metrics.md | ||
| replicationcontroller-metrics.md | ||
| resourcequota-metrics.md | ||
| role-metrics.md | ||
| rolebinding-metrics.md | ||
| secret-metrics.md | ||
| service-metrics.md | ||
| serviceaccount-metrics.md | ||
| statefulset-metrics.md | ||
| storageclass-metrics.md | ||
| validatingwebhookconfiguration-metrics.md | ||
| volumeattachment-metrics.md | ||
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
- CertificateSigningRequest Metrics
- ConfigMap Metrics
- CronJob Metrics
- DaemonSet Metrics
- Deployment Metrics
- Endpoint Metrics
- Horizontal Pod Autoscaler Metrics
- Ingress Metrics
- Job Metrics
- Lease Metrics
- LimitRange Metrics
- MutatingWebhookConfiguration Metrics
- Namespace Metrics
- NetworkPolicy Metrics
- Node Metrics
- PersistentVolume Metrics
- PersistentVolumeClaim Metrics
- Pod Disruption Budget Metrics
- Pod Metrics
- ReplicaSet Metrics
- ReplicationController Metrics
- ResourceQuota Metrics
- Secret Metrics
- Service Metrics
- StatefulSet Metrics
- StorageClass Metrics
- ValidatingWebhookConfiguration Metrics
- VolumeAttachment Metrics
Optional Resources
- ClusterRole Metrics
- ClusterRoleBinding Metrics
- EndpointSlice Metrics
- IngressClass Metrics
- Role Metrics
- RoleBinding Metrics
- ServiceAccount Metrics
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