Can't find replicaset kube state metrics in Prometheus

9/26/2021

I'm trying to set some alarms based on replica set metrics but Prometheus cannot find replicaset kube state metrics while browsing expressions. What would be the problem with that? On Prometheus dashboard, I can see lots of metrics, which is in kube state metrics repo, but replica sets. Any ideas?

Kube state metrics version: v1.9.7

Update:

For example, I can see most of deployment metrics on the dashboard, but no metrics for replica sets.

enter image description here

-- cosmos-1905-14
kube-state-metrics
kubernetes
prometheus

2 Answers

10/4/2021

In my case, replicasets in the ClusterRole was missing. After adding this line, the problem resolved. Thanks @Andrew Skorkin to remind me of checking logs.

-- cosmos-1905-14
Source: StackOverflow

10/2/2021

This is a community wiki answer posted for better clarity. Feel free to expand it.

As @ cosmos-1905-14 described, he checked the kube-state-metric logs and found that the ServiceAccount did not have sufficient rights to access the ReplicaSets. After he added the necessary rights, the issue was resolved.

-- Andrew Skorkin
Source: StackOverflow