Skip to content
Branch: master
Find file History
k8s-ci-robot Merge pull request #961 from lyft/hpa-metrics
add hpa stats for current utilization and average value
Latest commit e51fc8f Nov 5, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
design docs: rename the Documentation folder to docs Feb 20, 2019
developer add instructions for adding a new k8s resource Oct 10, 2019
README.md Merge branch 'master' into networkpolicy-collector Oct 17, 2019
certificatessigningrequest-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
cli-arguments.md Merge branch 'master' into networkpolicy-collector Oct 17, 2019
configmap-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
cronjob-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
daemonset-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
deployment-metrics.md deployment status conditions Sep 19, 2019
endpoint-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
horizontalpodautoscaler-metrics.md add hpa stats for current utilization and average value Nov 4, 2019
ingress-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
job-metrics.md Fix typo in the job metrics description Oct 8, 2019
limitrange-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
mutatingwebhookconfiguration.md add mutatingwebhookconfiguration, validatingwebhookconfiguration metrics Oct 3, 2019
namespace-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
networkpolicy-metrics.md store: export NetworkPolicy objects Oct 17, 2019
node-metrics.md document the new pod-cidr dimension Nov 1, 2019
persistentvolume-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
persistentvolumeclaim-metrics.md -m ADD kube_persistentvolumeclaim_status_condition metric for informa… Oct 25, 2019
pod-metrics.md feat: add kube_pod_status_unschedulable metric Aug 9, 2019
poddisruptionbudget-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
replicaset-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
replicationcontroller-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
resourcequota-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
secret-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
service-metrics.md
statefulset-metrics.md Merge release-1.7 into upstream/master Aug 5, 2019
storageclass-metrics.md remove storageclass resource_version Jun 6, 2019
validatingwebhookconfiguration.md add mutatingwebhookconfiguration, validatingwebhookconfiguration metrics Oct 3, 2019
verticalpodautoscaler-metrics.md store: add verticalpodautoscaler metrics Jun 20, 2019
volumeattachment-metrics.md add VolumeAttachment collector Oct 13, 2019

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.

Metrics Deprecation

  • The following non-generic resource metrics for pods are marked deprecated. They will be removed in kube-state-metrics v2.0.0. kube_pod_container_resource_requests and kube_pod_container_resource_limits are the replacements with resource labels representing the resource name and unit labels representing the resource unit.
    • kube_pod_container_resource_requests_cpu_cores
    • kube_pod_container_resource_limits_cpu_cores
    • kube_pod_container_resource_requests_memory_bytes
    • kube_pod_container_resource_limits_memory_bytes
  • The following non-generic resource metrics for nodes are marked deprecated. They will be removed in kube-state-metrics v2.0.0. kube_node_status_capacity and kube_node_status_allocatable are the replacements with resource labels representing the resource name and unit labels representing the resource unit.
    • kube_node_status_capacity_pods
    • kube_node_status_capacity_cpu_cores
    • kube_node_status_capacity_memory_bytes
    • kube_node_status_allocatable_pods
    • kube_node_status_allocatable_cpu_cores
    • kube_node_status_allocatable_memory_bytes

Exposed Metrics

Per group of metrics there is one file for each metrics. See each file for specific documentation about the exposed 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_memory_bytes) by (namespace, pod, node)
  * on (pod) group_left()  (sum(kube_pod_status_phase{phase="Running"}) by (pod, namespace) == 1)

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

You can’t perform that action at this time.