KUBERNETES CAFE
Getting started with Kube-State-Metrics and Kubernetes Dashboard
Introduction to Kube-State-Metrics
kube-state-metrics
is an open-source project to generate metrics about the state of the Kubernetes Cluster Objects. It is a service that listens to the Kubernetes API server. It does not perform any modification on Kubernetes API just reads the required data for metrics.
Where we can use it?
kube-state-metrics
exposes raw data unmodified from the Kubernetes API. This allows users to have all the data they require and perform heuristics as they see fit. These metrics are designed to be consumed either by Prometheus itself or by a scraper that is compatible with scraping a Prometheus client endpoint like Kubernetes dashboard, Elasticsearch Metricbeat etc.
How we can use it?
We can build and run kube-state-metrics
inside a Kubernetes pod that has access to a service account token that has read-only access to the Kubernetes cluster. This pod will be able to fetch the data and expose it via service. We can deploy other components that can use this data for monitoring, reporting, etc.