Discovery/Kubernetes: If target is Node, attach labels of it.#3748
Discovery/Kubernetes: If target is Node, attach labels of it.#3748cofyc wants to merge 1 commit intoprometheus:masterfrom
Conversation
For all targets backed by a node, all labels of the `role: node` discovery are attached.
|
I don't think the entire node labels are necessary. A generic target |
|
I'm a big confused by this, can you share the prometheus.yml you are using? |
|
@brian-brazil In short, we want to vector matching on metrics from kubelet and kube-state-metrics. But if kubelet target are discoveried through @brancz That would be much simpler! I created a separate PR to address this: #3770 |
|
Got it, that makes sense. As an explanation why the nodes are in the |
What this PR does
For all targets backed by a node, all labels of the
role: nodediscovery are attached.
Why we need it
We are currently using prometheus-operator to scrape metrics from kubelet.
prometheus-operatormaintains a endpoint object (kubeletby default), e.g:In current prometheus, if kubernetes discovery role is
endpoint, it does not attach labels ofrole: node. Metrics scraped fromkubeleton each node does not contain node labels. In many cases, we need to do vector matching with others metrics (e.g.kube_node_labelsfromkube-state-metrics). But without node name label, it's hard to do.IMHO, it will be convenient, if targets backed by a node, all labels of the
role: nodediscovery are attached, like
Podtarget.