Answers: <pre><code>label_values(kube_node_role, role)
  
  sum(kube_pod_container_resource_requests_cpu_cores
    * on (node) group_left (role) kube_node_role{role="$node_role"})
  </code></pre>
  
  <p>kube_node_role out of kube-state-metrics can give you a relationship to join</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-02-28T20:01:17.080Z
Answers: 2020-02-28T20:01:17.080Z
Answers: Brando___
Body: <p>In 1.16 k8s deprecated the label kubernetes.io/role: worker
  I had previously been using as a filter to target graphs to specific node role using this in my grafana variables declaration</p>
  
  <pre><code>label_values(kube_node_labels, label_kubernetes_io_role) 
  #join series based on the the label value
    sum(kube_pod_container_resource_requests_cpu_cores
    * on (node) group_left (label_kubernetes_io_role) kube_node_labels{label_kubernetes_io_role="$node_role"}
  </code></pre>
  
  <p>In this scary new world of using the label <code>node-role.kubernetes.io/worker: ""</code> this no longer works, nor can I necessarily regex it when the part I care about is in the key.</p>
  
  <p>Is there a new way anybody knows of to filter queries by arbitrary labels on the node</p>
  
Tags: <prometheus>
Title: Prometheus - join series based on the key part of a label
UserDisplayName: Brando___
ThreadText: # Prometheus - join series based on the key part of a label
  
  (Asked by: username_0 on 2020-02-28)
  
  In 1.16 k8s deprecated the label kubernetes.io/role: worker
  I had previously been using as a filter to target graphs to specific node role using this in my grafana variables declaration
  
  ```
  label_values(kube_node_labels, label_kubernetes_io_role) 
  #join series based on the the label value
    sum(kube_pod_container_resource_requests_cpu_cores
    * on (node) group_left (label_kubernetes_io_role) kube_node_labels{label_kubernetes_io_role="$node_role"}
  
  ```
  
  In this scary new world of using the label `node-role.kubernetes.io/worker: ""` this no longer works, nor can I necessarily regex it when the part I care about is in the key.
  
  Is there a new way anybody knows of to filter queries by arbitrary labels on the node
  
  **Tags:** prometheus
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-02-28. Score: 2 | Accepted answer
  
  ```
  label_values(kube_node_role, role)
  
  sum(kube_pod_container_resource_requests_cpu_cores
    * on (node) group_left (role) kube_node_role{role="$node_role"})
  
  ```
  
  kube\_node\_role out of kube-state-metrics can give you a relationship to join
  
  
  ---
  
  