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 they require and perform heuristics as required.

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 either 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 that the agent can discover kube-state.
Note: 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.

Metrics

OpsRamp MetricMetric Display NameUnitDescription
kube_state_daemonset_desiredDaemonset DesiredNumber of nodes that should be running the daemon POD
kube_state_daemonset_misscheduledDaemonset MisscheduledNumber of nodes running a daemon POD but are not supposed to
kube_state_daemonset_readyDaemonset ReadyNumber of nodes that should be running the daemon POD and have one or more of the daemon pod running and ready
kube_state_daemonset_scheduledDaemonset Currently ScheduledNumber of nodes running at least one daemon POD and are supposed to
kube_state_daemonset_updatedDaemonset Updated Spec ScheduledThe total number of nodes that are running updated daemon POD
kube_state_deployment_pausedDeployment PausedThe deployment is paused and will not be processed by the deployment controller
kube_state_deployment_replicasDeployment ReplicasNumber of replicas per deployment
kube_state_deployment_replicas_availableDeployment Replicas AvailableNumber of available replicas per deployment
kube_state_deployment_replicas_desiredDeployment Replicas DesiredNumber of desired replicas per deployment
kube_state_deployment_replicas_unavailableDeployment Replicas UnavailableNumber of unavailable replicas per deployment
kube_state_deployment_replicas_updatedDeployment Replicas UpdatedNumber of updated replicas per deployment
kube_state_deployment_rollingupdate_max_unavailableDeployment Rollingupdate Max UnavailableMaximum number of unavailable replicas during a rolling update of a deployment
kube_state_deployment_rollingupdate_max_surgeDeployment Rollingupdate Max SurgeMaximum number of replicas that can be scheduled above the desired number of replicas during a rolling update of a deployment
kube_state_endpoint_address_availableAddresses Available In EndpointNumber of addresses available in endpoint
kube_state_endpoint_address_not_readyAddresses Not Ready In EndpointNumber of addresses not ready in endpoint
kube_state_endpoint_createdEnpoint Creation TimestampTimestamp of UNIX creation
kube_state_job_status_failedJobs Failed Per PODNumber of PODs that reached the phase failed for a job
kube_state_job_status_succeededJobs Succeeded Per PODNumber of PODs that reached the phase succeeded for a job
kube_state_node_cpu_capacityNode Cpu CapacityTotal CPU resources of the node
kube_state_node_cpu_allocatableNode Cpu AllocatableCPU resources of a node that are available for scheduling
kube_state_node_memory_capacityNode Memory CapacityTotal memory resources of the node
kube_state_node_memory_allocatableNode Memory AllocatableMemory resources of a node that are available for scheduling
kube_state_node_pods_allocatableNode Pods AllocatablePOD resources of a node that are available for scheduling
kube_state_node_pods_capacityNode Pods CapacityTotal POD resources of the node
kube_state_node_statusNode StatusCondition of a cluster node. Sum this metric by either status to get the number of nodes in that status
kube_state_nodes_by_conditionNode Status By ConditionSum by `condition` and `status` to get number of nodes in a given condition
kube_state_pod_readyPOD ReadyDescribes 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
kube_state_pod_scheduledPOD ScheduledDescribes the status of the scheduling process for the POD
kube_state_container_cpu_limitContainer Cpu LimitLimit on CPU cores to be used by a container
kube_state_container_cpu_requestedContainer Cpu RequestedNumber of requested CPU cores by a container
kube_state_container_memory_limitContainer Memory LimitbytesLimit on memory to be used by a container
kube_state_container_memory_requestedContainer Memory RequestedNumber of requested memory bytes by a container
kube_state_container_readyContainer ReadyCkeck the readiness of the container
kube_state_container_restartsContainer RestartsNumber of restarts per container
kube_state_container_runningContainer RunningChecks if the container is running
kube_state_container_terminatedContainer TerminatedChecks if the container is currently in terminated state
kube_state_container_waitingContainer WaitingChecks if the container is currently in waiting state
kube_state_pdb_pods_desiredPDB Desired Healthy PodsMinimum desired number of healthy pods
kube_state_pdb_disruptions_allowedPDB Disruptions AllowedNumber of POD disruptions that are currently allowed
kube_state_pdb_pods_healthyPDB Healthy PodsCurrent number of healthy pods
kube_state_pdb_pods_totalPDB Pods TotalTotal number of pods counted by this disruption budget
kube_state_replicaset_fully_labeled_replicasReplicaset Fully Labeled ReplicasNumber of fully labeled replicas per ReplicaSet
kube_state_replicaset_replicasReplicaset ReplicasNumber of replicas per ReplicaSet
kube_state_replicaset_replicas_desiredReplicaset Replicas DesiredNumber of desired pods for a ReplicaSet
kube_state_replicaset_replicas_readyReplicaset Replicas ReadyNumber of ready replicas per ReplicaSet
kube_state_replicationcontroller_replicasReplicationController ReplicasNumber of replicas per ReplicationController
kube_state_replicationcontroller_fully_labeled_replicasReplicationController Fully LabeledNumber of fully labeled replicas per ReplicationController
kube_state_replicationcontroller_replicas_readyReplicationController ReadyNumber of ready replicas per ReplicationController
kube_state_replicationcontroller_replicas_desiredReplicationController DesiredNumber of desired pods for a ReplicationController
kube_state_replicationcontroller_replicas_availableReplicationController AvailableNumber of available replicas per ReplicationController
kube_state_statefulset_replicasStatefulSet ReplicasNumber of replicas per StatefulSet
kube_state_statefulset_replicas_desiredStatefulSet Desired PodsNumber of desired PODs for a StatefulSet
kube_state_statefulset_replicas_currentStatefulSet Current ReplicasNumber of current replicas per StatefulSet
kube_state_statefulset_replicas_readyStatefulSet Ready ReplicasNumber of ready replicas per StatefulSet
kube_state_statefulset_replicas_updatedStatefulSet Updated ReplicasNumber of updated replicas per StatefulSet
kube_state_resourcequota_limits_cpu_limitResourcequota Limits Cpu LimitHard limit on the sum of CPU core limits for a resource quota
kube_state_resourcequota_limits_cpu_usedResourcequota Limits Cpu UsedObserved sum of limits for CPU cores for a resource quota
kube_state_resourcequota_limits_memory_limitResourcequota Limits Memory LimitHard limit on the sum of memory bytes limits for a resource quota
kube_state_resourcequota_limits_memory_usedResourcequota Limits Memory UsedObserved sum of limits for memory bytes for a resource quota
kube_state_resourcequota_persistentvolumeclaims_limitResourcequota Persistentvolumeclaims LimitHard limit of the number of PVC for a resource quota
kube_state_resourcequota_persistentvolumeclaims_usedResourcequota Persistentvolumeclaims UsedObserved number of persistent volume claims used for a resource quota
kube_state_resourcequota_pods_limitResourcequota Pods LimitHard limit of the number of pods for a resource quota
kube_state_resourcequota_pods_usedResourcequota Pods UsedObserved number of pods used for a resource quota
kube_state_resourcequota_requests_cpu_limitResourcequota Requests Cpu LimitHard limit on the total of CPU core requested for a resource quota
kube_state_resourcequota_requests_cpu_usedResourcequota Requests Cpu UsedObserved sum of CPU cores requested for a resource quota
kube_state_resourcequota_requests_memory_limitResourcequota Requests Memory LimitHard limit on the total of memory bytes requested for a resource quota
kube_state_resourcequota_requests_memory_usedResourcequota Requests Memory UsedObserved sum of memory bytes requested for a resource quota
kube_state_resourcequota_requests_storage_limitResourcequota Requests Storage LimitHard limit on the total of storage bytes requested for a resource quota
kube_state_resourcequota_requests_storage_usedResourcequota Requests Storage UsedObserved sum of storage bytes requested for a resource quota
kube_state_resourcequota_services_limitResourcequota Services LimitHard limit of the number of services for a resource quota
kube_state_resourcequota_services_loadbalancers_limitResourcequota Services Loadbalancers LimitHard limit of the number of loadbalancers for a resource quota
kube_state_resourcequota_services_loadbalancers_usedResourcequota Services Loadbalancers UsedObserved number of loadbalancers used for a resource quota
kube_state_resourcequota_services_nodeports_limitResourcequota Services Nodeports LimitHard limit of the number of node ports for a resource quota
kube_state_resourcequota_services_nodeports_usedResourcequota Services Nodeports UsedObserved number of node ports used for a resource quota
kube_state_resourcequota_services_usedResourcequota Services UsedObserved number of services used for a resource quota
kube_state_limitrange_cpu_minLimitRange CPU MinMinimum CPU request for this type
kube_state_limitrange_cpu_maxLimitRange CPU MaxMaximum CPU limit for this type
kube_state_limitrange_cpu_defaultLimitRange CPU DefaultDefault CPU limit if not specified
kube_state_limitrange_cpu_default_requestLimitRange CPU Default RequestDefault CPU request if not specified
kube_state_limitrange_cpu_max_limit_request_ratioLimitRange CPU Max Limit Request RatioMaximum CPU limit / request ratio
kube_state_limitrange_memory_minLimitRange Memory MinMinimum memory request for this type
kube_state_limitrange_memory_maxLimitRange Memory MaxMaximum memory limit for this type
kube_state_limitrange_memory_defaultLimitRange Memory DefaultDefault memory limit if not specified
kube_state_limitrange_memory_default_requestLimitRange Memory Default RequestDefault memory request if not specified
kube_state_limitrange_memory_max_limit_request_ratioLimitRange Memory Max Limit Request RatioMaximum memory limit / request ratio
kube_state_hpa_min_replicasHPA Min ReplicasLower limit for the number of pods that can be set by the autoscaler, default 1
kube_state_hpa_max_replicasHPA Max ReplicasUpper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas
kube_state_hpa_desired_replicasHPA Desired ReplicasDesired number of replicas of pods managed by this autoscaler
kube_state_hpa_conditionHPA ConditionCondition of autoscaler