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 the unmodified raw data from the Kubernetes API. Therefore, the users have all the data needed to define heuristics.
The metrics are exported on the HTTP endpoint /metrics on the listening port (default 8080) and are served as plaintext. The metrics are designed to be consumed 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.
Prerequisite
Use of the following service for kube-state so for the agent can discover kube-state.
Ensure that clusterIP is not None.
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/version: 2.0.0-alpha.3
name: kube-state-metrics
namespace: kube-system
spec:
ports:
- name: http-metrics
port: 8080
targetPort: http-metrics
- name: telemetry
port: 8081
targetPort: telemetry
selector:
app.kubernetes.io/name: kube-state-metrics
Validate
Go to Resources under the Infrastructure tab to check if your resources are onboarded and the metrics are collected.
Supported metrics
OpsRamp Metric | Metric Display Name | Unit |
---|---|---|
kube_state_daemonset_desired Number of nodes that should be running the daemon POD | Daemonset Desired | |
kube_state_daemonset_misscheduled Number of nodes running a daemon POD but are not supposed to | Daemonset Misscheduled | |
kube_state_daemonset_ready Number of nodes that should be running the daemon POD and have one or more of the daemon pod running and ready | Daemonset Ready | |
kube_state_daemonset_scheduled Number of nodes running at least one daemon POD and are supposed to | Daemonset Currently Scheduled | |
kube_state_daemonset_updated The total number of nodes that are running updated daemon POD | Daemonset Updated Spec Scheduled | |
kube_state_deployment_paused The deployment is paused and is not processed by the deployment controller | Deployment Paused | |
kube_state_deployment_replicas Number of replicas per deployment | Deployment Replicas | |
kube_state_deployment_replicas_available Number of available replicas per deployment | Deployment Replicas Available | |
kube_state_deployment_replicas_desired Number of desired replicas per deployment | Deployment Replicas Desired | |
kube_state_deployment_replicas_unavailable Number of unavailable replicas per deployment | Deployment Replicas Unavailable | |
kube_state_deployment_replicas_updated Number of updated replicas per deployment | Deployment Replicas Updated | |
kube_state_deployment_rollingupdate_max_unavailable Maximum number of unavailable replicas during a rolling update of a deployment | Deployment Rollingupdate Max Unavailable | |
kube_state_deployment_rollingupdate_max_surge Maximum number of replicas that can be scheduled above the desired number of replicas during a rolling update of a deployment | Deployment Rollingupdate Max Surge | |
kube_state_endpoint_address_available Number of addresses available in endpoint | Addresses Available In Endpoint | |
kube_state_endpoint_address_not_ready Number of addresses not ready in endpoint | Addresses Not Ready In Endpoint | |
kube_state_endpoint_created Timestamp of UNIX creation | Enpoint Creation Timestamp | |
kube_state_job_status_failed Number of PODs that reached the phase failed for a job | Jobs Failed Per POD | |
kube_state_job_status_succeeded Number of PODs that reached the phase succeeded for a job | Jobs Succeeded Per POD | |
kube_state_node_cpu_capacity Total CPU resources of the node | Node Cpu Capacity | |
kube_state_node_cpu_allocatable CPU resources of a node that are available for scheduling | Node Cpu Allocatable | |
kube_state_node_memory_capacity Total memory resources of the node | Node Memory Capacity | |
kube_state_node_memory_allocatable Memory resources of a node that are available for scheduling | Node Memory Allocatable | |
kube_state_node_pods_allocatable POD resources of a node that are available for scheduling | Node Pods Allocatable | |
kube_state_node_pods_capacity Total POD resources of the node | Node Pods Capacity | |
kube_state_node_status Condition of a cluster node. Sum this metric by status to get the number of nodes in that status | Node Status | |
kube_state_nodes_by_condition Sum by `condition` and `status` to get number of nodes in a given condition | Node Status By Condition | |
kube_state_pod_ready Describes whether the POD is ready to serve requests. In association with the `condition` tag, whether the POD is ready to serve requests, for example, `condition:true` keeps the pods that are in a ready state | POD Ready | |
kube_state_pod_scheduled Describes the status of the scheduling process for the POD | POD Scheduled | |
kube_state_container_cpu_limit Limit on CPU cores to be used by a container | Container Cpu Limit | |
kube_state_container_cpu_requested Number of requested CPU cores by a container | Container Cpu Requested | |
kube_state_container_memory_limit Limit on memory to be used by a container | Container Memory Limit | bytes |
kube_state_container_memory_requested Number of requested memory bytes by a container | Container Memory Requested | |
kube_state_container_ready Ckeck the readiness of the container | Container Ready | |
kube_state_container_restarts Number of restarts per container | Container Restarts | |
kube_state_container_running Checks if the container is running | Container Running | |
kube_state_container_terminated Checks if the container is currently in terminated state | Container Terminated | |
kube_state_container_waiting Checks if the container is currently in waiting state | Container Waiting | |
kube_state_pdb_pods_desired Minimum desired number of healthy pods | PDB Desired Healthy Pods | |
kube_state_pdb_disruptions_allowed Number of POD disruptions that are currently allowed | PDB Disruptions Allowed | |
kube_state_pdb_pods_healthy Current number of healthy pods | PDB Healthy Pods | |
kube_state_pdb_pods_total Total number of pods counted by this disruption budget | PDB Pods Total | |
kube_state_replicaset_fully_labeled_replicas Number of fully labeled replicas per ReplicaSet | Replicaset Fully Labeled Replicas | |
kube_state_replicaset_replicas Number of replicas per ReplicaSet | Replicaset Replicas | |
kube_state_replicaset_replicas_desired Number of desired pods for a ReplicaSet | Replicaset Replicas Desired | |
kube_state_replicaset_replicas_ready Number of ready replicas per ReplicaSet | Replicaset Replicas Ready | |
kube_state_replicationcontroller_replicas Number of replicas per ReplicationController | ReplicationController Replicas | |
kube_state_replicationcontroller_fully_labeled_replicas Number of fully labeled replicas per ReplicationController | ReplicationController Fully Labeled | |
kube_state_replicationcontroller_replicas_ready Number of ready replicas per ReplicationController | ReplicationController Ready | |
kube_state_replicationcontroller_replicas_desired Number of desired pods for a ReplicationController | ReplicationController Desired | |
kube_state_replicationcontroller_replicas_available Number of available replicas per ReplicationController | ReplicationController Available | |
kube_state_statefulset_replicas Number of replicas per StatefulSet | StatefulSet Replicas | |
kube_state_statefulset_replicas_desired Number of desired PODs for a StatefulSet | StatefulSet Desired Pods | |
kube_state_statefulset_replicas_current Number of current replicas per StatefulSet | StatefulSet Current Replicas | |
kube_state_statefulset_replicas_ready Number of ready replicas per StatefulSet | StatefulSet Ready Replicas | |
kube_state_statefulset_replicas_updated Number of updated replicas per StatefulSet | StatefulSet Updated Replicas | |
kube_state_resourcequota_limits_cpu_limit Hard limit on the sum of CPU core limits for a resource quota | Resourcequota Limits Cpu Limit | |
kube_state_resourcequota_limits_cpu_used Observed sum of limits for CPU cores for a resource quota | Resourcequota Limits Cpu Used | |
kube_state_resourcequota_limits_memory_limit Hard limit on the sum of memory bytes limits for a resource quota | Resourcequota Limits Memory Limit | |
kube_state_resourcequota_limits_memory_used Observed sum of limits for memory bytes for a resource quota | Resourcequota Limits Memory Used | |
kube_state_resourcequota_persistentvolumeclaims_limit Hard limit of the number of PVC for a resource quota | Resourcequota Persistentvolumeclaims Limit | |
kube_state_resourcequota_persistentvolumeclaims_used Observed number of persistent volume claims used for a resource quota | Resourcequota Persistentvolumeclaims Used | |
kube_state_resourcequota_pods_limit Hard limit of the number of pods for a resource quota | Resourcequota Pods Limit | |
kube_state_resourcequota_pods_used Observed number of pods used for a resource quota | Resourcequota Pods Used | |
kube_state_resourcequota_requests_cpu_limit Hard limit on the total of CPU core requested for a resource quota | Resourcequota Requests Cpu Limit | |
kube_state_resourcequota_requests_cpu_used Observed sum of CPU cores requested for a resource quota | Resourcequota Requests Cpu Used | |
kube_state_resourcequota_requests_memory_limit Hard limit on the total of memory bytes requested for a resource quota | Resourcequota Requests Memory Limit | |
kube_state_resourcequota_requests_memory_used Observed sum of memory bytes requested for a resource quota | Resourcequota Requests Memory Used | |
kube_state_resourcequota_requests_storage_limit Hard limit on the total of storage bytes requested for a resource quota | Resourcequota Requests Storage Limit | |
kube_state_resourcequota_requests_storage_used Observed sum of storage bytes requested for a resource quota | Resourcequota Requests Storage Used | |
kube_state_resourcequota_services_limit Hard limit of the number of services for a resource quota | Resourcequota Services Limit | |
kube_state_resourcequota_services_loadbalancers_limit Hard limit of the number of loadbalancers for a resource quota | Resourcequota Services Loadbalancers Limit | |
kube_state_resourcequota_services_loadbalancers_used Observed number of loadbalancers used for a resource quota | Resourcequota Services Loadbalancers Used | |
kube_state_resourcequota_services_nodeports_limit Hard limit of the number of node ports for a resource quota | Resourcequota Services Nodeports Limit | |
kube_state_resourcequota_services_nodeports_used Observed number of node ports used for a resource quota | Resourcequota Services Nodeports Used | |
kube_state_resourcequota_services_used Observed number of services used for a resource quota | Resourcequota Services Used | |
kube_state_limitrange_cpu_min Minimum CPU request for this type | LimitRange CPU Min | |
kube_state_limitrange_cpu_max Maximum CPU limit for this type | LimitRange CPU Max | |
kube_state_limitrange_cpu_default Default CPU limit if not specified | LimitRange CPU Default | |
kube_state_limitrange_cpu_default_request Default CPU request if not specified | LimitRange CPU Default Request | |
kube_state_limitrange_cpu_max_limit_request_ratio Maximum CPU limit / request ratio | LimitRange CPU Max Limit Request Ratio | |
kube_state_limitrange_memory_min Minimum memory request for this type | LimitRange Memory Min | |
kube_state_limitrange_memory_max Maximum memory limit for this type | LimitRange Memory Max | |
kube_state_limitrange_memory_default Default memory limit if not specified | LimitRange Memory Default | |
kube_state_limitrange_memory_default_request Default memory request if not specified | LimitRange Memory Default Request | |
kube_state_limitrange_memory_max_limit_request_ratio Maximum memory limit / request ratio | LimitRange Memory Max Limit Request Ratio | |
kube_state_hpa_min_replicas Lower limit for the number of pods that can be set by the autoscaler, default 1 | HPA Min Replicas | |
kube_state_hpa_max_replicas Upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas | HPA Max Replicas | |
kube_state_hpa_desired_replicas Desired number of replicas of pods managed by this autoscaler | HPA Desired Replicas | |
kube_state_hpa_condition Condition of autoscaler | HPA Condition |