<p>I am trying to monitor my cluster Kubernetes and I am using prometheus to get all informations.</p>

<p>It's working perfectly but, I need to monitor some specific workers and I need to label it using __meta_kubernetes_namespace, but could not find any reference explaining how to change it in the kubnernetes Environment.</p>

<p>Please help me to resolve it,</p>

<p>Thank you.</p>

<p>You would need to write your own <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config" rel="nofollow noreferrer">scrape config</a> for <a href="https://prometheus.io/" rel="nofollow noreferrer">Prometheus</a>.</p>

<p>This is a partial snipit of istio envoy proxies stats, you should write your own based on what resources to monitor and where to look for them:</p>

<pre><code>    - job_name: 'envoy-stats'
      metrics_path: /stats/prometheus
      kubernetes_sd_configs:
      - role: pod
      relabel_configs:
      - source_labels: [__meta_kubernetes_pod_container_port_name]
        action: keep
        regex: '.*-envoy-prom'
      - source_labels: [__meta_kubernetes_namespace]
        action: replace
        target_label: namespace
      - source_labels: [__meta_kubernetes_pod_name]
        action: replace
        target_label: pod_name
      metric_relabel_configs:
      # Exclude some of the envoy metrics that have massive cardinality
      # This list may need to be pruned further moving forward, as informed
      # by performance and scalability testing.
      - source_labels: [ __name__ ]
        regex: 'envoy_http_(stats|admin).*'
        action: drop
      - source_labels: [ __name__ ]
        regex: 'envoy_cluster_(lb|retry|bind|internal|max|original).*'
        action: drop
</code></pre>

<p>Also please go over <a href="https://prometheus.io/docs/introduction/first_steps/" rel="nofollow noreferrer">first steps with prometheus</a> as this will be helpful in working with Prometheus.</p>
