<p>I need to add a label to all default rules that come with the Helm chart. I tried setting the label under <code>commonLabels</code> in the values file, to no avail. I also tried putting it as <code>external_labels</code> within the <code>defaultRules</code> stanza, again didn't do the trick. When I add the label to rules I define myself under <code>AdditionalAlerts</code>, it works fine. But I need it for all alerts.</p>
<p>I also added it under the &quot;labels for default rules&quot;. The label got added to the metadata of each of the default rules, but I need it inside the spec of the rule, under the already existing label for &quot;severity&quot;.</p>
<p>The end goal is to put the environment inside that label, e.g. TEST, STAGING and PRODUCTION. So if anyone has another way to accomplish this, by all means....</p>

<p>You can upgrade your values.yaml file for Prometheus with the necessary labels in the <code>additionalRuleLabels</code> section for <code>defaultRules</code>.</p>
<p>Below is an example based on the <a href="https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L70" rel="nofollow noreferrer">values.yaml file from the Prometheus Monitoring Community</a>:</p>
<pre><code>defaultRules:
  ## Additional labels for PrometheusRule alerts
  additionalRuleLabels:
    additionalRuleLabel1: additinalRuleValue1
</code></pre>
<p>Result:
<a href="https://i.stack.imgur.com/ACq3K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ACq3K.png" alt="enter image description here" /></a></p>
