Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kube-state-metrics keeps failed pods around for kube_pod_* metrics #414

Closed
dlespiau opened this issue Apr 4, 2018 · 6 comments · Fixed by #423
Closed

kube-state-metrics keeps failed pods around for kube_pod_* metrics #414

dlespiau opened this issue Apr 4, 2018 · 6 comments · Fixed by #423

Comments

@dlespiau
Copy link

dlespiau commented Apr 4, 2018

Some kube_pod_* metrics exist for Failed pods:

kube_pod_info
kube_pod_owner
kube_pod_labels
kube_pod_created
kube_pod_start_time

kube_status_phase shows that kube-state-metrics is populating this group of metrics with information about the failed (non running) pods:
screenshot from 2018-04-04 13-35-16

kubectl is indeed confirming there's only one pod running (and so are the kube_pod_container_* metrics).

I would expect the metrics above to only show Pending|Running pods, maybe Unknown but I'm not sure when the last value is set and seems like it could be a transient state more than anything else.

@andyxning
Copy link
Member

@dlespiau This is the desired behavior for kube-state-metrics to scrape kube_pod_info or other metrics for failed pods. As stated many times in other places by @brancz , kube-state-metrics just scrape the object from Kubernetes and emit the corresponding metrics via different criteria.

If you do not like two show kube_pod_info or other metrics for failed pods, you can join kube_status_phase with other metrics to only show up running or pending pods info.

On the other hand, some users may still want to query those info to or analyze or add an alarm.

@dlespiau
Copy link
Author

dlespiau commented Apr 9, 2018

Hi Andy. That makes sense, but your "As stated many times in other places" makes me think that's not what people are expecting the default behaviour to be, ie. by default report only running pods and join with kube_status_phase for error conditions. That said, that'd be an "API" breaking change, so that certainly seems like a deal breaker.

Maybe having it somewhere at a prominent place in the docs would alleviate the problem of an unexpected behaviour, it seems like a big trap people fall into.

@andyxning
Copy link
Member

andyxning commented Apr 10, 2018

@dlespiau IMHO, it should be a common sense that metrics like kube_pod_info should contain all the object of that type. So, i do not know where we should add this statement and how to say about this truth. WDYT @brancz

@brancz
Copy link
Member

brancz commented Apr 10, 2018

I think it would be fair to add a note high in then readme calling out that kube-state-metrics is about representing the state of the Kubernetes API as metrics as opposed to “what kubectl shows”.

@andyxning
Copy link
Member

@brancz Will you help to add this tip?

@dlespiau
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants