kube-state-metrics is a simple service that listens to the Kubernetes API server
and generates metrics about the state of the objects.
Here you will find a list of yamls: link
It contains:
Deployment: Where container fetches image: quay.io/coreos/kube-state-metrics:v1.6.0
Service account: Service account of deployment object
Role and RoleBinding: RBAC cluster role and role binding for the service account
Service: k8s service that listen to the pods under deployments
So when you have all these set up. You are ready to go. Now you configure your prometheus to scrape metrics from the k8s Service you created in no. 4.
Here you will find how to generate address
for the k8s service.
Configure prometheus:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'kube-state-metrics'
static_configs:
- targets: ['address'] //address of the k8s service