1

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
  • 783
  • 2
  • 12
  • 23
  • Hi, @cosmos-1905-14 Which version of Kubernetes are you using? – Andrew Skorkin Sep 27 '21 at 12:43
  • Hi @AndrewSkorkin I'm using `1.18` – cosmos-1905-14 Sep 27 '21 at 14:21
  • I've tried to reproduce this issue on Kubernetes 1.18 with different versions of kube-state-metrics: 1.8, 1.9.7. `kube_replicaset_...` metrics available for me. So, kube-state-metrics support them for such version. Do you have ReplicaSets deployed right now? – Andrew Skorkin Sep 29 '21 at 08:49
  • the issue is resolved upon checking `kube-state-metric` logs. SA hasn't enough privileges to access replicasets. – cosmos-1905-14 Sep 30 '21 at 13:23
  • Fine! Since the issue resolved, could you please provide your resolution as an answer not a comment? It will be useful for other people to see founded solution. Thank you. – Andrew Skorkin Sep 30 '21 at 22:49

2 Answers2

1

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
  • 1,147
  • 3
  • 11
0

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
  • 783
  • 2
  • 12
  • 23