Lab 10.1: Installing and configuring Kube State Metrics


Kube state metrics is available as a public docker image. You will have to deploy the following Kubernetes objects for Kube state metrics to work.

  1. A Service Account
  2. Cluster Role – For kube state metrics to access all the Kubernetes API objects.
  3. Cluster Role Binding – Binds the service account with the cluster role.
  4. Kube State Metrics Deployment
  5. Service – To expose the metrics

All the above Kube state metrics objects will be deployed in the kube-system namespace.

Let’s deploy the components. All the deployment objects are available in Github. You can also find the same deployment object in the official repo as well.

1. Clone the Github repo

git clone https://github.com/devopscube/kube-state-metrics-configs.git

2. Create all the objects by pointing to the cloned directory.

kubectl apply -f kube-state-metrics-configs/

3. Check the deployment status using the following command.

kubectl get deployments kube-state-metrics -n kube-system