Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upKubernetes: Pods don't have their deployment as a label #2073
Comments
This comment has been minimized.
This comment has been minimized.
|
As a heads up, we are currently in the process of rewriting the kubernetes service discovery. As far as I understand your problem can be solved by pointing a service at the pods created through the deployment, and then use endpoint discovery. Then you can adapt your query to select the up metric based on the service name. |
This comment has been minimized.
This comment has been minimized.
|
Hi Frederic, Thanks for the pointers! I just gave the service endpoint discovery a try and it looks like that also has its own set of limitations:
|
This comment has been minimized.
This comment has been minimized.
|
If that's what you want you can use relabelling rules to map for example the pod name to a label. However, I don't see how
is a problem. (All time series include the instance label, indicating where it was scraped from) For example: I have a Deployment of Prometheus in kubernetes and then run this query in the console:
Then the result includes the instance label: So what you could do is this query:
Which would be the same semantic as your query, as soon as there are more instances down than up it triggers. You can also have a look into kube-state-metrics as you can combine more information with it. |
This comment has been minimized.
This comment has been minimized.
|
Oh, wow. This is interesting. There is indeed an Now I'm sort of backtracking why I didn't notice this earlier. Instead of running queries, I was merely looking at the Would it make sense to extend this page to simply show all labels that will be attached instead of making some of these ( |
This comment has been minimized.
This comment has been minimized.
|
No problem, happy I could help! I can see how implicit labels might be confusing. I wouldn't mind displaying it, however, this was worked on way before my time |
This comment has been minimized.
This comment has been minimized.
This is already the case. The tooltip labels are those available to relabelling.
|
This comment has been minimized.
This comment has been minimized.
|
Thanks for sharing Brian! That makes sense, and thanks for correcting my statement. |
This comment has been minimized.
This comment has been minimized.
|
Actually since #2062 has just been merged all existing labels are viewed on the targets page. The job label is implicit, however, shown through the grouping of targets. Hope it's all clarified @EdSchouten. |
This comment has been minimized.
This comment has been minimized.
|
That makes sense. Thanks a lot! |
EdSchouten
closed this
Oct 12, 2016
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |


EdSchouten commentedOct 10, 2016
•
edited
What did you do?
We're using the latest version of the
prom/prometheusDocker image, so that we can run Prometheus on Kubernetes 1.3.6. Our Prometheus configuration is almost entirely based on a stock version of:https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml
What did you expect to see?
We were expecting to see that the name of the deployment of a pod would also be available through a label attached to metrics related to pods. That way you could just say something like this:
In other words: throw an alert if more than half of the jobs in the deployment are down.
What did you see instead? Under which circumstances?
When starting up pods, they get discovered and scraped by Prometheus. They properly have their namespace, pod name, etc. associated with it, but no deployment name. For example:
Environment
System information:
Linux 4.6.3-coreos x86_64
Prometheus version:
https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml