<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>mimir on Grafana Labs</title><link>https://grafana.com/docs/alloy/v1.15/reference/components/mimir/</link><description>Recent content in mimir on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/alloy/v1.15/reference/components/mimir/index.xml" rel="self" type="application/rss+xml"/><item><title>mimir.alerts.kubernetes</title><link>https://grafana.com/docs/alloy/v1.15/reference/components/mimir/mimir.alerts.kubernetes/</link><pubDate>Mon, 13 Apr 2026 07:37:47 +0000</pubDate><guid>https://grafana.com/docs/alloy/v1.15/reference/components/mimir/mimir.alerts.kubernetes/</guid><content><![CDATA[&lt;h1 id=&#34;mimiralertskubernetes&#34;&gt;&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt;&lt;/h1&gt;


&lt;div data-shared=&#34;stability/experimental.md&#34;&gt;
            &lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;: This is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental&lt;/a&gt; component.
Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement.
To enable and use an experimental component, you must set the &lt;code&gt;stability.level&lt;/code&gt; 
    &lt;a href=&#34;/docs/alloy/v1.15/reference/cli/run/&#34;&gt;flag&lt;/a&gt; to &lt;code&gt;experimental&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;/div&gt;

        
&lt;p&gt;&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; discovers &lt;code&gt;AlertmanagerConfig&lt;/code&gt; Kubernetes resources and loads them into a Mimir instance.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can specify multiple &lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; components by giving them different labels.&lt;/li&gt;
&lt;li&gt;You can use &lt;a href=&#34;https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Kubernetes label selectors&lt;/a&gt; to limit the &lt;code&gt;Namespace&lt;/code&gt; and &lt;code&gt;AlertmanagerConfig&lt;/code&gt; resources considered during reconciliation.&lt;/li&gt;
&lt;li&gt;Compatible with the Alertmanager APIs of Grafana Mimir, Grafana Cloud, and Grafana Enterprise Metrics.&lt;/li&gt;
&lt;li&gt;Compatible with the &lt;code&gt;AlertmanagerConfig&lt;/code&gt; CRD from the &lt;a href=&#34;https://prometheus-operator.dev/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;prometheus-operator&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;This component accesses the Kubernetes REST API from &lt;a href=&#34;https://kubernetes.io/docs/tasks/run-application/access-api-from-pod/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;within a Pod&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This component requires &lt;a href=&#34;https://kubernetes.io/docs/reference/access-authn-authz/rbac/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Role-based access control (RBAC)&lt;/a&gt; to be set up in Kubernetes in order for Alloy to access it via the Kubernetes REST API.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; doesn&amp;rsquo;t support &lt;a href=&#34;../../../../get-started/clustering/&#34;&gt;clustering&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;mimir.alerts.kubernetes &amp;#34;&amp;lt;LABEL&amp;gt;&amp;#34; {
  address       = &amp;#34;&amp;lt;MIMIR_URL&amp;gt;&amp;#34;
  global_config = &amp;#34;...&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;p&gt;You can use the following arguments with &lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;address&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of the Mimir Alertmanager.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;global_config&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href=&#34;https://prometheus.io/docs/alerting/latest/configuration/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Alertmanager configuration&lt;/a&gt; to be merged with AlertmanagerConfig CRDs.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;bearer_token_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing a bearer token to authenticate with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;bearer_token&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Bearer token to authenticate with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_http2&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether HTTP2 is supported for requests.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;follow_redirects&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether redirects returned by the server should be followed.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;http_headers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(list(secret))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Custom HTTP headers to be sent along with each request. The map key is the header name.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;no_proxy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(list(secret))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Specifies headers to send to proxies during CONNECT requests.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Use the proxy URL indicated by environment variables.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;HTTP proxy to send requests through.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;sync_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Amount of time between reconciliations with Mimir.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;5m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;template_files&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;A map of Alertmanager &lt;a href=&#34;/docs/mimir/latest/references/http-api/#set-alertmanager-configuration&#34;&gt;template files&lt;/a&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;{}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;At most, one of the following can be provided:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[&lt;code&gt;authorization&lt;/code&gt;][authorization] block&lt;/li&gt;
&lt;li&gt;[&lt;code&gt;basic_auth&lt;/code&gt;][basic_auth] block&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#arguments&#34;&gt;&lt;code&gt;bearer_token_file&lt;/code&gt;&lt;/a&gt;argument&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#arguments&#34;&gt;&lt;code&gt;bearer_token&lt;/code&gt;&lt;/a&gt; argument&lt;/li&gt;
&lt;li&gt;[&lt;code&gt;oauth2&lt;/code&gt;][oauth2] block&lt;/li&gt;
&lt;/ul&gt;


&lt;div data-shared=&#34;reference/components/http-client-proxy-config-description.md&#34;&gt;
            &lt;p&gt;&lt;code&gt;no_proxy&lt;/code&gt; can contain IPs, CIDR notations, and domain names. IP and domain names can contain port numbers.
&lt;code&gt;proxy_url&lt;/code&gt; must be configured if &lt;code&gt;no_proxy&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt; uses the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof).
Requests use the proxy from the environment variable matching their scheme, unless excluded by NO_PROXY.
&lt;code&gt;proxy_url&lt;/code&gt; and &lt;code&gt;no_proxy&lt;/code&gt; must not be configured if &lt;code&gt;proxy_from_environment&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt; should only be configured if &lt;code&gt;proxy_url&lt;/code&gt; or &lt;code&gt;proxy_from_environment&lt;/code&gt; are configured.&lt;/p&gt;
&lt;/div&gt;

        
&lt;h2 id=&#34;blocks&#34;&gt;Blocks&lt;/h2&gt;
&lt;p&gt;The following blocks are supported inside the definition of
&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;config-app&#34; style=&#34;--config-tree-row-count: 10;&#34; x3-data=&#34;configVisualizer(&amp;#34;\u003csection class=\&amp;#34;expand-table-wrapper\&amp;#34;\u003e\u003cdiv class=\&amp;#34;button-div\&amp;#34;\u003e\n      \u003cbutton class=\&amp;#34;expand-table-btn\&amp;#34;\u003eExpand table\u003c/button\u003e\n    \u003c/div\u003e\u003cdiv class=\&amp;#34;responsive-table-wrapper\&amp;#34;\u003e\n    \u003ctable\u003e\n      \u003cthead\u003e\n          \u003ctr\u003e\n              \u003cth\u003eBlock\u003c/th\u003e\n              \u003cth\u003eDescription\u003c/th\u003e\n              \u003cth\u003eRequired\u003c/th\u003e\n          \u003c/tr\u003e\n      \u003c/thead\u003e\n      \u003ctbody\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#authorization\&amp;#34;\u003e\u003ccode\u003eauthorization\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure generic authorization to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#basic_auth\&amp;#34;\u003e\u003ccode\u003ebasic_auth\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure \u003ccode\u003ebasic_auth\u003c/code\u003e for authenticating to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#oauth2\&amp;#34;\u003e\u003ccode\u003eoauth2\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure OAuth 2.0 for authenticating to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003eoauth2\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#tls_config\&amp;#34;\u003e\u003ccode\u003etls_config\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure TLS settings for connecting to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#alertmanagerconfig_selector-and-alertmanagerconfig_namespace_selector\&amp;#34;\u003e\u003ccode\u003ealertmanagerconfig_namespace_selector\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel selector for \u003ccode\u003eNamespace\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ealertmanagerconfig_namespace_selector\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#match_expression\&amp;#34;\u003e\u003ccode\u003ematch_expression\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel match expression for \u003ccode\u003eNamespace\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#alertmanagerconfig_selector-and-alertmanagerconfig_namespace_selector\&amp;#34;\u003e\u003ccode\u003ealertmanagerconfig_selector\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel selector for \u003ccode\u003eAlertmanagerConfig\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ealertmanagerconfig_selector\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#match_expression\&amp;#34;\u003e\u003ccode\u003ematch_expression\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel match expression for \u003ccode\u003eAlertmanagerConfig\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003ealertmanagerconfig_matcher\u003c/code\u003e\u003c/td\u003e\n              \u003ctd\u003eStrategy to match alerts to \u003ccode\u003eAlertmanagerConfig\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#tls_config\&amp;#34;\u003e\u003ccode\u003etls_config\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure TLS settings for connecting to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n      \u003c/tbody\u003e\n    \u003c/table\u003e\n  \u003c/div\u003e\n\u003c/section\u003e&amp;#34;)&#34;&gt;
  &lt;noscript&gt;
    &lt;div class=&#34;config-app__noscript&#34;&gt;&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Block&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#authorization&#34;&gt;&lt;code&gt;authorization&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure generic authorization to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#basic_auth&#34;&gt;&lt;code&gt;basic_auth&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure &lt;code&gt;basic_auth&lt;/code&gt; for authenticating to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#oauth2&#34;&gt;&lt;code&gt;oauth2&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure OAuth 2.0 for authenticating to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;oauth2&lt;/code&gt; &amp;gt; &lt;a href=&#34;#tls_config&#34;&gt;&lt;code&gt;tls_config&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure TLS settings for connecting to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#alertmanagerconfig_selector-and-alertmanagerconfig_namespace_selector&#34;&gt;&lt;code&gt;alertmanagerconfig_namespace_selector&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label selector for &lt;code&gt;Namespace&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;alertmanagerconfig_namespace_selector&lt;/code&gt; &amp;gt; &lt;a href=&#34;#match_expression&#34;&gt;&lt;code&gt;match_expression&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label match expression for &lt;code&gt;Namespace&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#alertmanagerconfig_selector-and-alertmanagerconfig_namespace_selector&#34;&gt;&lt;code&gt;alertmanagerconfig_selector&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label selector for &lt;code&gt;AlertmanagerConfig&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;alertmanagerconfig_selector&lt;/code&gt; &amp;gt; &lt;a href=&#34;#match_expression&#34;&gt;&lt;code&gt;match_expression&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label match expression for &lt;code&gt;AlertmanagerConfig&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;alertmanagerconfig_matcher&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Strategy to match alerts to &lt;code&gt;AlertmanagerConfig&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#tls_config&#34;&gt;&lt;code&gt;tls_config&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure TLS settings for connecting to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;
  &lt;/noscript&gt;
  &lt;main class=&#34;config-app__main&#34;&gt;
    &lt;template x3-if=&#34;flatBlocks.length === 0&#34;&gt;
      &lt;div class=&#34;empty-state&#34;&gt;
        &lt;div class=&#34;empty-state__icon&#34; x3-html=&#34;icons.AlertCircle&#34;&gt;&lt;/div&gt;
        &lt;p&gt;No valid configuration blocks found.&lt;/p&gt;
      &lt;/div&gt;
    &lt;/template&gt;

    &lt;template x3-if=&#34;flatBlocks.length &gt; 0&#34;&gt;
      &lt;div class=&#34;config-tree&#34;&gt;
        &lt;div class=&#34;config-tree__toolbar&#34;&gt;
          &lt;div class=&#34;config-tree__title&#34;&gt;&lt;/div&gt;
          &lt;button
            class=&#34;tree-explorer__button w-130 text-right&#34;
            x3-on:click=&#34;toggleExpandAll&#34;
            x3-bind:title=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;
          &gt;
            &lt;span x3-text=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;&gt;&lt;/span&gt;
            &lt;svg class=&#34;api-icon&#34; viewBox=&#34;0 0 24 24&#34;&gt;
              &lt;path x3-show=&#34;!allExpanded&#34; d=&#34;m6 9 6 6 6-6&#34; /&gt;
              &lt;path x3-show=&#34;allExpanded&#34; d=&#34;m18 15-6-6-6 6&#34; /&gt;
            &lt;/svg&gt;
          &lt;/button&gt;
        &lt;/div&gt;

        &lt;div class=&#34;nodes-container&#34;&gt;
          &lt;template x3-for=&#34;block in flatBlocks&#34; x3-bind:key=&#34;block.id&#34;&gt;
            &lt;div class=&#34;node&#34; x3-bind:class=&#34;isNodeVisible(block) ? &#39;node--visible&#39; : &#39;node--hidden&#39;&#34;&gt;
              &lt;div
                class=&#34;node__row&#34;
                x3-bind:class=&#34;getRowClass(block)&#34;
                x3-bind:style=&#34;`padding-left: ${block.level * 24 &#43; 16}px`&#34;
                x3-on:click=&#34;toggleNode(block.id)&#34;
              &gt;
                &lt;div class=&#34;node__left&#34;&gt;
                  &lt;div class=&#34;node__indicator&#34;&gt;
                    &lt;template x3-if=&#34;block.hasChildren&#34;&gt;
                      &lt;button type=&#34;button&#34; class=&#34;node__toggle&#34; x3-on:click.stop=&#34;toggleNode(block.id)&#34;&gt;
                        &lt;div
                          class=&#34;node__toggle-icon&#34;
                          x3-bind:class=&#34;block.expanded ? &#39;node__toggle-icon--expanded&#39; : &#39;&#39;&#34;
                          x3-html=&#34;icons.ChevronDown&#34;
                        &gt;&lt;/div&gt;
                      &lt;/button&gt;
                    &lt;/template&gt;
                    &lt;template x3-if=&#34;!block.hasChildren&#34;&gt;
                      &lt;div class=&#34;node__toggle-spacer&#34;&gt;&lt;/div&gt;
                    &lt;/template&gt;
                  &lt;/div&gt;

                  &lt;div class=&#34;node__content&#34;&gt;
                    &lt;div
                      class=&#34;node__title prose&#34;
                      x3-bind:class=&#34;block.level === 0 ? &#39;node__title--root&#39; : &#39;node__title--nested&#39;&#34;
                      x3-html=&#34;block.displayName&#34;
                    &gt;&lt;/div&gt;
                    &lt;div class=&#34;node__description body-xsmall&#34; x3-html=&#34;block.description&#34;&gt;&lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;

                &lt;div class=&#34;node__meta&#34;&gt;
                  &lt;span
                    class=&#34;badge&#34;
                    x3-bind:class=&#34;block.required ? &#39;badge--required&#39; : &#39;badge--optional&#39;&#34;
                    x3-text=&#34;block.required ? &#39;Required&#39; : &#39;Optional&#39;&#34;
                  &gt;&lt;/span&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/template&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/template&gt;
  &lt;/main&gt;
&lt;/div&gt;

&lt;h3 id=&#34;authorization&#34;&gt;&lt;code&gt;authorization&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/authorization-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;credentials_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing the secret value.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;credentials&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Secret value.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;type&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Authorization type, for example, &amp;ldquo;Bearer&amp;rdquo;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;code&gt;credential&lt;/code&gt; and &lt;code&gt;credentials_file&lt;/code&gt; are mutually exclusive, and only one can be provided inside an &lt;code&gt;authorization&lt;/code&gt; block.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;credentials_file&lt;/code&gt; causes the file to be read on every outgoing request.
Use the &lt;code&gt;local.file&lt;/code&gt; component with the &lt;code&gt;credentials&lt;/code&gt; attribute instead to avoid unnecessary reads.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;h3 id=&#34;basic_auth&#34;&gt;&lt;code&gt;basic_auth&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/basic-auth-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;password_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing the basic auth password.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;password&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Basic auth password.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;username&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Basic auth username.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;code&gt;password&lt;/code&gt; and &lt;code&gt;password_file&lt;/code&gt; are mutually exclusive, and only one can be provided inside a &lt;code&gt;basic_auth&lt;/code&gt; block.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;password_file&lt;/code&gt; causes the file to be read on every outgoing request.
Use the &lt;code&gt;local.file&lt;/code&gt; component with the &lt;code&gt;password&lt;/code&gt; attribute instead to avoid unnecessary reads.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;h3 id=&#34;alertmanagerconfig_selector-and-alertmanagerconfig_namespace_selector&#34;&gt;&lt;code&gt;alertmanagerconfig_selector&lt;/code&gt; and &lt;code&gt;alertmanagerconfig_namespace_selector&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;alertmanagerconfig_selector&lt;/code&gt; and &lt;code&gt;alertmanagerconfig_namespace_selector&lt;/code&gt; blocks describe a Kubernetes label selector for AlertmanagerConfig CRDs or namespace discovery.&lt;/p&gt;
&lt;p&gt;The following arguments are supported:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;match_labels&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Label keys and values used to discover resources.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;{}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When the &lt;code&gt;match_labels&lt;/code&gt; argument is empty, all resources are matched.&lt;/p&gt;
&lt;h3 id=&#34;match_expression&#34;&gt;&lt;code&gt;match_expression&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;match_expression&lt;/code&gt; block describes a Kubernetes label match expression for AlertmanagerConfig CRDs or namespace discovery.&lt;/p&gt;
&lt;p&gt;The following arguments are supported:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The label name to match against.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;operator&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The operator to use when matching.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;values&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The values used when matching.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;operator&lt;/code&gt; argument should be one of the following strings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;In&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;NotIn&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;Exists&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;DoesNotExist&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;values&lt;/code&gt; argument must not be provided when &lt;code&gt;operator&lt;/code&gt; is set to &lt;code&gt;&amp;quot;Exists&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;DoesNotExist&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;alertmanagerconfig_matcher&#34;&gt;&lt;code&gt;alertmanagerconfig_matcher&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;alertmanagerconfig_matcher&lt;/code&gt; block describes the strategy used by AlertmanagerConfig objects to match alerts in the routes and inhibition rules.&lt;/p&gt;
&lt;p&gt;Depending on how this block is configured, the final Alertmanager config will have different &lt;a href=&#34;https://prometheus.io/docs/alerting/latest/configuration/#matcher&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;matchers&lt;/a&gt; in its &lt;a href=&#34;https://prometheus.io/docs/alerting/latest/configuration/#route&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;route&lt;/a&gt; section.&lt;/p&gt;
&lt;p&gt;The following arguments are supported:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;strategy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Strategy for adding matchers to AlertmanagerConfig CRDs.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;OnNamespace&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;alertmanager_namespace&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Namespace to use when &lt;code&gt;alertmanagerconfig_matcher_strategy&lt;/code&gt; is set to &lt;code&gt;&amp;quot;OnNamespaceExceptForAlertmanagerNamespace&amp;quot;&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;only when &lt;code&gt;strategy&lt;/code&gt; is &lt;code&gt;&amp;quot;OnNamespaceExceptForAlertmanagerNamespace&amp;quot;&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;strategy&lt;/code&gt; argument should be one of the following strings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;OnNamespace&amp;quot;&lt;/code&gt;: Each AlertmanagerConfig object only matches alerts that have the &lt;code&gt;namespace&lt;/code&gt; label set to the same namespace as the AlertmanagerConfig object.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;OnNamespaceExceptForAlertmanagerNamespace&amp;quot;&lt;/code&gt;: The same as &lt;code&gt;&amp;quot;OnNamespace&amp;quot;&lt;/code&gt;, except for AlertmanagerConfigs in the namespace given by &lt;code&gt;alertmanager_namespace&lt;/code&gt;, which apply to all alerts.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;None&amp;quot;&lt;/code&gt;: Every AlertmanagerConfig object applies to all alerts&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;strategy&lt;/code&gt; is similar to the &lt;a href=&#34;https://prometheus-operator.dev/docs/api-reference/api/#monitoring.coreos.com/v1.AlertmanagerConfigMatcherStrategy&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;AlertmanagerConfigMatcherStrategy&lt;/a&gt; in Prometheus Operator, but it is configured in Alloy instead of in an Alertmanager CRD.
Alloy doesn&amp;rsquo;t require an Alertmanager CRD.&lt;/p&gt;
&lt;h3 id=&#34;oauth2&#34;&gt;&lt;code&gt;oauth2&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/oauth2-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;client_id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth2 client ID.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;client_secret_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing the OAuth2 client secret.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;client_secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth2 client secret.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;endpoint_params&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional parameters to append to the token URL.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;no_proxy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(list(secret))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Specifies headers to send to proxies during CONNECT requests.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Use the proxy URL indicated by environment variables.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;HTTP proxy to send requests through.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;scopes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of scopes to authenticate with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;token_url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL to fetch the token from.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;code&gt;client_secret&lt;/code&gt; and &lt;code&gt;client_secret_file&lt;/code&gt; are mutually exclusive, and only one can be provided inside an &lt;code&gt;oauth2&lt;/code&gt; block.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;client_secret_file&lt;/code&gt; causes the file to be read on every outgoing request.
Use the &lt;code&gt;local.file&lt;/code&gt; component with the &lt;code&gt;client_secret&lt;/code&gt; attribute instead to avoid unnecessary reads.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;oauth2&lt;/code&gt; block may also contain a separate &lt;code&gt;tls_config&lt;/code&gt; sub-block.&lt;/p&gt;


&lt;div data-shared=&#34;reference/components/http-client-proxy-config-description.md&#34;&gt;
            &lt;p&gt;&lt;code&gt;no_proxy&lt;/code&gt; can contain IPs, CIDR notations, and domain names. IP and domain names can contain port numbers.
&lt;code&gt;proxy_url&lt;/code&gt; must be configured if &lt;code&gt;no_proxy&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt; uses the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof).
Requests use the proxy from the environment variable matching their scheme, unless excluded by NO_PROXY.
&lt;code&gt;proxy_url&lt;/code&gt; and &lt;code&gt;no_proxy&lt;/code&gt; must not be configured if &lt;code&gt;proxy_from_environment&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt; should only be configured if &lt;code&gt;proxy_url&lt;/code&gt; or &lt;code&gt;proxy_from_environment&lt;/code&gt; are configured.&lt;/p&gt;
&lt;/div&gt;

        
&lt;/div&gt;

        
&lt;h3 id=&#34;tls_config&#34;&gt;&lt;code&gt;tls_config&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/tls-config-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ca_pem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;CA PEM-encoded text to validate the server with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ca_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;CA certificate to validate the server with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cert_pem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Certificate PEM-encoded text for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cert_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Certificate file for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;insecure_skip_verify&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disables validation of the server certificate.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;key_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Key file for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;key_pem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Key PEM-encoded text for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;min_version&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum acceptable TLS version.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;ServerName extension to indicate the name of the server.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The following pairs of arguments are mutually exclusive and can&amp;rsquo;t both be set simultaneously:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ca_pem&lt;/code&gt; and &lt;code&gt;ca_file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cert_pem&lt;/code&gt; and &lt;code&gt;cert_file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;key_pem&lt;/code&gt; and &lt;code&gt;key_file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When configuring client authentication, both the client certificate (using &lt;code&gt;cert_pem&lt;/code&gt; or &lt;code&gt;cert_file&lt;/code&gt;) and the client key (using &lt;code&gt;key_pem&lt;/code&gt; or &lt;code&gt;key_file&lt;/code&gt;) must be provided.&lt;/p&gt;
&lt;p&gt;When &lt;code&gt;min_version&lt;/code&gt; isn&amp;rsquo;t provided, the minimum acceptable TLS version is inherited from Go&amp;rsquo;s default minimum version, TLS 1.2.
If &lt;code&gt;min_version&lt;/code&gt; is provided, it must be set to one of the following strings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS10&amp;quot;&lt;/code&gt; (TLS 1.0)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS11&amp;quot;&lt;/code&gt; (TLS 1.1)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS12&amp;quot;&lt;/code&gt; (TLS 1.2)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS13&amp;quot;&lt;/code&gt; (TLS 1.3)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

        
&lt;h2 id=&#34;exported-fields&#34;&gt;Exported fields&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; doesn&amp;rsquo;t export any fields.&lt;/p&gt;
&lt;h2 id=&#34;component-health&#34;&gt;Component health&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; is reported as unhealthy if given an invalid configuration or an error occurs during reconciliation.&lt;/p&gt;
&lt;h2 id=&#34;debug-information&#34;&gt;Debug information&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; doesn&amp;rsquo;t expose debug information.&lt;/p&gt;
&lt;h2 id=&#34;debug-metrics&#34;&gt;Debug metrics&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Metric Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_alerts_mimir_client_request_duration_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;histogram&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Duration of requests to the Mimir API.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_alerts_config_updates_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of times the configuration has been updated.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_alerts_events_failed_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of events that failed to be processed, partitioned by event type.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_alerts_events_retried_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of events that were retried, partitioned by event type.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_alerts_events_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of events processed, partitioned by event type.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;p&gt;This example creates a &lt;code&gt;mimir.alerts.kubernetes&lt;/code&gt; component which only loads namespace and &lt;code&gt;AlertmanagerConfig&lt;/code&gt; resources if they contain an &lt;code&gt;alloy&lt;/code&gt; label set to &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;remote.kubernetes.configmap &amp;#34;default&amp;#34; {
  namespace = &amp;#34;default&amp;#34;
  name      = &amp;#34;alertmgr-global&amp;#34;
}

mimir.alerts.kubernetes &amp;#34;default&amp;#34; {
  address       = &amp;#34;http://mimir-nginx.mimir-test.svc:80&amp;#34;
  global_config = remote.kubernetes.configmap.default.data[&amp;#34;glbl&amp;#34;]

  template_files = {
    `default_template` = 
`{{ define &amp;#34;__alertmanager&amp;#34; }}AlertManager{{ end }}
{{ define &amp;#34;__alertmanagerURL&amp;#34; }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver | urlquery }}{{ end }}`,
  }

  alertmanagerconfig_selector {
      match_labels = {
          alloy = &amp;#34;yes&amp;#34;,
      }
  }

  alertmanagerconfig_namespace_selector {
      match_labels = {
          alloy = &amp;#34;yes&amp;#34;,
      }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following example is an RBAC configuration for Kubernetes.
It authorizes Alloy to query the Kubernetes REST API:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: v1
kind: ServiceAccount
metadata:
  name: alloy
  namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: alloy
rules:
- apiGroups: [&amp;#34;&amp;#34;]
  resources: [&amp;#34;namespaces&amp;#34;]
  verbs: [&amp;#34;get&amp;#34;, &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34;]
- apiGroups: [&amp;#34;monitoring.coreos.com&amp;#34;]
  resources: [&amp;#34;alertmanagerconfigs&amp;#34;]
  verbs: [&amp;#34;get&amp;#34;, &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34;]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: alloy
subjects:
- kind: ServiceAccount
  name: alloy
  namespace: default
roleRef:
  kind: ClusterRole
  name: alloy
  apiGroup: rbac.authorization.k8s.io&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following is an example of a complete Kubernetes configuration:&lt;/p&gt;
&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Example Kubernetes configuration.&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: v1
kind: Namespace
metadata:
  name: testing
  labels:
    alloy: &amp;#34;yes&amp;#34;
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: grafana-alloy
  namespace: testing
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: grafana-alloy
rules:
- apiGroups: [&amp;#34;&amp;#34;]
  resources: [&amp;#34;namespaces&amp;#34;, &amp;#34;configmaps&amp;#34;]
  verbs: [&amp;#34;get&amp;#34;, &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34;]
- apiGroups: [&amp;#34;monitoring.coreos.com&amp;#34;]
  resources: [&amp;#34;alertmanagerconfigs&amp;#34;]
  verbs: [&amp;#34;get&amp;#34;, &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34;]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: grafana-alloy
subjects:
- kind: ServiceAccount
  name: grafana-alloy
  namespace: testing
roleRef:
  kind: ClusterRole
  name: grafana-alloy
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: Service
metadata:
  name: grafana-alloy
spec:
  type: NodePort
  selector:
    app: grafana-alloy
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: testing
  name: grafana-alloy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana-alloy
  template:
    metadata:
      labels:
        app: grafana-alloy
    spec:
      serviceAccount: grafana-alloy
      containers:
      - name: alloy
        image: grafana/alloy:latest
        imagePullPolicy: Never
        args:
        - run
        - /etc/config/config.alloy
        - --stability.level=experimental
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: config-volume
          mountPath: /etc/config
      volumes:
        - name: config-volume
          configMap:
            name: alloy-config
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: alloy-config
  namespace: testing
data:
  config.alloy: |
      remote.kubernetes.configmap &amp;#34;default&amp;#34; {
        namespace = &amp;#34;testing&amp;#34;
        name = &amp;#34;alertmgr-global&amp;#34;
      }

      mimir.alerts.kubernetes &amp;#34;default&amp;#34; {
        address = &amp;#34;http://mimir-nginx.mimir-test.svc:80&amp;#34;
        global_config = remote.kubernetes.configmap.default.data[&amp;#34;glbl&amp;#34;]
        template_files = {
          `default_template` = 
      `{{ define &amp;#34;__alertmanager&amp;#34; }}AlertManager{{ end }}
      {{ define &amp;#34;__alertmanagerURL&amp;#34; }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver | urlquery }}{{ end }}`,
        }
        alertmanagerconfig_namespace_selector {
            match_labels = {
                alloy = &amp;#34;yes&amp;#34;,
            }
        }
        alertmanagerconfig_selector {
            match_labels = {
                alloy = &amp;#34;yes&amp;#34;,
            }
        }
      }
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: alertmgr-global
  namespace: testing
data:
  glbl: |
    global:
      resolve_timeout: 5m
      http_config:
        follow_redirects: true
        enable_http2: true
      smtp_hello: localhost
      smtp_require_tls: true
    route:
      receiver: &amp;#34;null&amp;#34;
    receivers:
    - name: &amp;#34;null&amp;#34;
    - name: &amp;#34;alloy-namespace/global-config/myreceiver&amp;#34;
    templates:
    - &amp;#39;default_template&amp;#39;
---
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: alertmgr-config1
  namespace: testing
  labels:
    alloy: &amp;#34;yes&amp;#34;
spec:
  route:
    receiver: &amp;#34;null&amp;#34;
    routes:
    - receiver: myamc
      continue: true
  receivers:
  - name: &amp;#34;null&amp;#34;
  - name: myamc
    webhookConfigs:
    - url: http://test.url
      httpConfig:
        followRedirects: true
---
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: alertmgr-config2
  namespace: testing
  labels:
    alloy: &amp;#34;yes&amp;#34;
spec:
  route:
    receiver: &amp;#34;null&amp;#34;
    routes:
    - receiver: &amp;#39;database-pager&amp;#39;
      groupWait: 10s
      matchers:
      - name: service
        value: webapp
  receivers:
  - name: &amp;#34;null&amp;#34;
  - name: &amp;#34;database-pager&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The Kubernetes configuration above creates the Alertmanager configuration below and sends it to Mimir:&lt;/p&gt;
&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Example merged configuration sent to Mimir.&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;template_files:
    default_template: |-
        {{ define &amp;#34;__alertmanager&amp;#34; }}AlertManager{{ end }}
        {{ define &amp;#34;__alertmanagerURL&amp;#34; }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver | urlquery }}{{ end }}
alertmanager_config: |
    global:
      resolve_timeout: 5m
      http_config:
        follow_redirects: true
        enable_http2: true
      smtp_hello: localhost
      smtp_require_tls: true
    route:
      receiver: &amp;#34;null&amp;#34;
      continue: false
      routes:
      - receiver: testing/alertmgr-config1/null
        matchers:
        - namespace=&amp;#34;testing&amp;#34;
        continue: true
        routes:
        - receiver: testing/alertmgr-config1/myamc
          continue: true
      - receiver: testing/alertmgr-config2/null
        matchers:
        - namespace=&amp;#34;testing&amp;#34;
        continue: true
        routes:
        - receiver: testing/alertmgr-config2/database-pager
          matchers:
          - service=&amp;#34;webapp&amp;#34;
          continue: false
          group_wait: 10s
    receivers:
    - name: &amp;#34;null&amp;#34;
    - name: alloy-namespace/global-config/myreceiver
    - name: testing/alertmgr-config1/null
    - name: testing/alertmgr-config1/myamc
      webhook_configs:
      - send_resolved: false
        http_config:
          follow_redirects: true
          enable_http2: true
        url: &amp;lt;secret&amp;gt;
        url_file: &amp;#34;&amp;#34;
        max_alerts: 0
        timeout: 0s
    - name: testing/alertmgr-config2/null
    - name: testing/alertmgr-config2/database-pager
    templates:
    - default_template&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;You can add the &lt;code&gt;alertmanagerconfig_matcher&lt;/code&gt; block to your Alloy configuration to remove the namespace matchers:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;alertmanagerconfig_matcher {
  strategy = &amp;#34;None&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This results in the following final configuration:&lt;/p&gt;
&lt;div class=&#34;collapse&#34; x-data=&#34;app_collapse()&#34;&gt;
  &lt;button class=&#34;collapse-trigger&#34; @click=&#34;toggle()&#34;&gt;
    &lt;span class=&#34;body-large&#34;&gt;Example merged configuration sent to Mimir.&lt;/span&gt;
    &lt;span class=&#34;collapse-trigger__icon&#34; :class=&#34;{ &#39;collapse-trigger__icon-open&#39; : open }&#34;&gt;
      
  &lt;svg width=&#34;27&#34; height=&#34;26&#34; viewBox=&#34;0 0 27 26&#34; fill=&#34;none&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path opacity=&#34;0.2&#34; d=&#34;M1.73047 12.8359C1.73047 19.4634 7.10305 24.8359 13.7305 24.8359C20.3579 24.8359 25.7305 19.4634 25.7305 12.8359C25.7305 6.20852 20.3579 0.835937 13.7305 0.835937C7.10305 0.835937 1.73047 6.20852 1.73047 12.8359Z&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M18.2344 12.8359L9.23438 12.8359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;path d=&#34;M13.7344 8.33594L13.7344 17.3359&#34; stroke=&#34;black&#34; stroke-width=&#34;1.5&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;
&lt;/svg&gt;


    &lt;/span&gt;
  &lt;/button&gt;
  &lt;div class=&#34;collapse-content&#34; x-ref=&#34;content&#34; hidden=&#34;until-found&#34;&gt;
    &lt;div class=&#34;collapse-content__inner&#34; x-ref=&#34;content-inner&#34;&gt;
&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;template_files:
    default_template: |-
        {{ define &amp;#34;__alertmanager&amp;#34; }}AlertManager{{ end }}
        {{ define &amp;#34;__alertmanagerURL&amp;#34; }}{{ .ExternalURL }}/#/alerts?receiver={{ .Receiver | urlquery }}{{ end }}
alertmanager_config: |
    global:
      resolve_timeout: 5m
      http_config:
        follow_redirects: true
        enable_http2: true
      smtp_hello: localhost
      smtp_require_tls: true
    route:
      receiver: &amp;#34;null&amp;#34;
      continue: false
      routes:
      - receiver: testing/alertmgr-config1/null
        continue: true
        routes:
        - receiver: testing/alertmgr-config1/myamc
          continue: true
      - receiver: testing/alertmgr-config2/null
        continue: true
        routes:
        - receiver: testing/alertmgr-config2/database-pager
          matchers:
          - service=&amp;#34;webapp&amp;#34;
          continue: false
          group_wait: 10s
    receivers:
    - name: &amp;#34;null&amp;#34;
    - name: alloy-namespace/global-config/myreceiver
    - name: testing/alertmgr-config1/null
    - name: testing/alertmgr-config1/myamc
      webhook_configs:
      - send_resolved: false
        http_config:
          follow_redirects: true
          enable_http2: true
        url: &amp;lt;secret&amp;gt;
        url_file: &amp;#34;&amp;#34;
        max_alerts: 0
        timeout: 0s
    - name: testing/alertmgr-config2/null
    - name: testing/alertmgr-config2/database-pager
    templates:
    - default_template&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

]]></content><description>&lt;h1 id="mimiralertskubernetes">&lt;code>mimir.alerts.kubernetes&lt;/code>&lt;/h1>
&lt;div data-shared="stability/experimental.md">
&lt;blockquote>
&lt;p>&lt;strong>EXPERIMENTAL&lt;/strong>: This is an &lt;a href="/docs/release-life-cycle/">experimental&lt;/a> component.
Experimental components are subject to frequent breaking changes, and may be removed with no equivalent replacement.
To enable and use an experimental component, you must set the &lt;code>stability.level&lt;/code>
&lt;a href="/docs/alloy/v1.15/reference/cli/run/">flag&lt;/a> to &lt;code>experimental&lt;/code>.&lt;/p></description></item><item><title>mimir.rules.kubernetes</title><link>https://grafana.com/docs/alloy/v1.15/reference/components/mimir/mimir.rules.kubernetes/</link><pubDate>Mon, 13 Apr 2026 07:37:47 +0000</pubDate><guid>https://grafana.com/docs/alloy/v1.15/reference/components/mimir/mimir.rules.kubernetes/</guid><content><![CDATA[&lt;h1 id=&#34;mimirruleskubernetes&#34;&gt;&lt;code&gt;mimir.rules.kubernetes&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; discovers &lt;code&gt;PrometheusRule&lt;/code&gt; Kubernetes resources and loads them into a Mimir instance.&lt;/p&gt;
&lt;p&gt;It can also &lt;a href=&#34;/docs/mimir/latest/references/architecture/components/ruler/#federated-rule-groups&#34;&gt;federate rules&lt;/a&gt; from different source tenants into a target Mimir tenant by interpreting the &lt;code&gt;monitoring.grafana.com/source_tenants&lt;/code&gt; annotation on &lt;code&gt;PrometheusRule&lt;/code&gt; resources.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can specify multiple &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; components by giving them different labels.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Kubernetes label selectors&lt;/a&gt; let you limit the &lt;code&gt;Namespace&lt;/code&gt; and &lt;code&gt;PrometheusRule&lt;/code&gt; resources the component considers during reconciliation.&lt;/li&gt;
&lt;li&gt;Compatible with the Ruler APIs of Grafana Mimir, Grafana Cloud, and Grafana Enterprise Metrics.&lt;/li&gt;
&lt;li&gt;Compatible with the &lt;code&gt;PrometheusRule&lt;/code&gt; CRD from the &lt;a href=&#34;https://prometheus-operator.dev/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;prometheus-operator&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;This component accesses the Kubernetes REST API from &lt;a href=&#34;https://kubernetes.io/docs/tasks/run-application/access-api-from-pod/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;within a Pod&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;You must configure Role-based access control (RBAC) in Kubernetes so Alloy can access the Kubernetes REST API.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;



&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Alloy version 1.1 and higher supports &lt;a href=&#34;../../../../get-started/clustering/&#34;&gt;clustered mode&lt;/a&gt; in this component.
When you use this component as part of a cluster of Alloy instances, only a single instance from the cluster updates rules using the Mimir API.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;mimir.rules.kubernetes &amp;#34;&amp;lt;LABEL&amp;gt;&amp;#34; {
  address = &amp;#34;&amp;lt;MIMIR_RULER_URL&amp;gt;&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;p&gt;You can use the following arguments with &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt;:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;address&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL of the Mimir ruler.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;bearer_token_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing a bearer token to authenticate with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;bearer_token&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Bearer token to authenticate with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;enable_http2&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether to enable HTTP2 for requests.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;external_labels&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Labels to add to each rule.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;{}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;follow_redirects&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether to follow redirects returned by the server.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;http_headers&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(list(secret))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Custom HTTP headers to send with each request. The map key is the header name.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_namespace_prefix&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Prefix used to differentiate multiple Alloy deployments.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;alloy&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;no_proxy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;prometheus_http_prefix&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Path prefix for the &lt;a href=&#34;/docs/mimir/latest/references/http-api/&#34;&gt;Mimir Prometheus endpoint&lt;/a&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;/prometheus&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(list(secret))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Specifies headers to send to proxies during CONNECT requests.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Use the proxy URL indicated by environment variables.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;HTTP proxy to send requests through.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;sync_interval&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;duration&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Amount of time between reconciliations with Mimir.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;&amp;quot;5m&amp;quot;&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;tenant_id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Mimir tenant ID. Required when you enable Mimir multi-tenancy.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;use_legacy_routes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Whether to use deprecated ruler API endpoints.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;You can provide at most one of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;[&lt;code&gt;authorization&lt;/code&gt;][authorization] block&lt;/li&gt;
&lt;li&gt;[&lt;code&gt;basic_auth&lt;/code&gt;][basic_auth] block&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#arguments&#34;&gt;&lt;code&gt;bearer_token_file&lt;/code&gt;&lt;/a&gt; argument&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#arguments&#34;&gt;&lt;code&gt;bearer_token&lt;/code&gt;&lt;/a&gt; argument&lt;/li&gt;
&lt;li&gt;[&lt;code&gt;oauth2&lt;/code&gt;][oauth2] block&lt;/li&gt;
&lt;/ul&gt;


&lt;div data-shared=&#34;reference/components/http-client-proxy-config-description.md&#34;&gt;
            &lt;p&gt;&lt;code&gt;no_proxy&lt;/code&gt; can contain IPs, CIDR notations, and domain names. IP and domain names can contain port numbers.
&lt;code&gt;proxy_url&lt;/code&gt; must be configured if &lt;code&gt;no_proxy&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt; uses the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof).
Requests use the proxy from the environment variable matching their scheme, unless excluded by NO_PROXY.
&lt;code&gt;proxy_url&lt;/code&gt; and &lt;code&gt;no_proxy&lt;/code&gt; must not be configured if &lt;code&gt;proxy_from_environment&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt; should only be configured if &lt;code&gt;proxy_url&lt;/code&gt; or &lt;code&gt;proxy_from_environment&lt;/code&gt; are configured.&lt;/p&gt;
&lt;/div&gt;

        
&lt;p&gt;If you don&amp;rsquo;t provide &lt;code&gt;tenant_id&lt;/code&gt;, the component assumes the Mimir instance at &lt;code&gt;address&lt;/code&gt; runs in single-tenant mode.
The component doesn&amp;rsquo;t send an &lt;code&gt;X-Scope-OrgID&lt;/code&gt; header.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The mimir-distributed Helm chart enables multi-tenancy by default.&lt;/p&gt;
&lt;p&gt;When you enable multi-tenancy, requests to the Mimir Ruler API must include an &lt;code&gt;X-Scope-OrgID&lt;/code&gt; tenant header.
The &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; component sends this header only when you configure the &lt;code&gt;tenant_id&lt;/code&gt; argument.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t set &lt;code&gt;tenant_id&lt;/code&gt;, the Mimir API returns the error: &lt;code&gt;401 Unauthorized: no org id&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To resolve this, set the &lt;code&gt;tenant_id&lt;/code&gt; argument in the component configuration.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;sync_interval&lt;/code&gt; argument determines how often the component accesses the Mimir ruler API to reload the current state of rules.
The Kubernetes API delivers updates as events using the informer pattern.&lt;/p&gt;
&lt;p&gt;Use the &lt;code&gt;mimir_namespace_prefix&lt;/code&gt; argument to separate the rules that multiple Alloy deployments manage across your infrastructure.
Set it to a unique value for each deployment.&lt;/p&gt;
&lt;p&gt;If you set &lt;code&gt;use_legacy_routes&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt;, &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; contacts Mimir on a &lt;code&gt;/api/v1/rules&lt;/code&gt; endpoint.&lt;/p&gt;
&lt;p&gt;If you set &lt;code&gt;prometheus_http_prefix&lt;/code&gt; to &lt;code&gt;/mimir&lt;/code&gt;, &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; contacts Mimir on a &lt;code&gt;/mimir/config/v1/rules&lt;/code&gt; endpoint.
This is useful if you configure Mimir to use a different &lt;a href=&#34;/docs/mimir/latest/references/http-api/&#34;&gt;prefix&lt;/a&gt; for its Prometheus endpoints than the default one.&lt;/p&gt;
&lt;p&gt;The component ignores &lt;code&gt;prometheus_http_prefix&lt;/code&gt; if you set &lt;code&gt;use_legacy_routes&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;external_labels&lt;/code&gt; overrides label values if labels with the same names already exist inside the rule.&lt;/p&gt;
&lt;h2 id=&#34;blocks&#34;&gt;Blocks&lt;/h2&gt;
&lt;p&gt;You can use the following blocks with &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;config-app&#34; style=&#34;--config-tree-row-count: 11;&#34; x3-data=&#34;configVisualizer(&amp;#34;\u003csection class=\&amp;#34;expand-table-wrapper\&amp;#34;\u003e\u003cdiv class=\&amp;#34;button-div\&amp;#34;\u003e\n      \u003cbutton class=\&amp;#34;expand-table-btn\&amp;#34;\u003eExpand table\u003c/button\u003e\n    \u003c/div\u003e\u003cdiv class=\&amp;#34;responsive-table-wrapper\&amp;#34;\u003e\n    \u003ctable\u003e\n      \u003cthead\u003e\n          \u003ctr\u003e\n              \u003cth\u003eBlock\u003c/th\u003e\n              \u003cth\u003eDescription\u003c/th\u003e\n              \u003cth\u003eRequired\u003c/th\u003e\n          \u003c/tr\u003e\n      \u003c/thead\u003e\n      \u003ctbody\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#authorization\&amp;#34;\u003e\u003ccode\u003eauthorization\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure generic authorization to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#basic_auth\&amp;#34;\u003e\u003ccode\u003ebasic_auth\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure \u003ccode\u003ebasic_auth\u003c/code\u003e for authenticating to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#extra_query_matchers\&amp;#34;\u003e\u003ccode\u003eextra_query_matchers\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eAdditional label matchers to add to each query.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003eextra_query_matchers\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#matcher\&amp;#34;\u003e\u003ccode\u003ematcher\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eA label matcher to add to query.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#oauth2\&amp;#34;\u003e\u003ccode\u003eoauth2\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure OAuth 2.0 for authenticating to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003eoauth2\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#tls_config\&amp;#34;\u003e\u003ccode\u003etls_config\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure TLS settings for connecting to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#rule_selector-and-rule_namespace_selector\&amp;#34;\u003e\u003ccode\u003erule_namespace_selector\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel selector for \u003ccode\u003eNamespace\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003erule_namespace_selector\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#match_expression\&amp;#34;\u003e\u003ccode\u003ematch_expression\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel match expression for \u003ccode\u003eNamespace\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#rule_selector-and-rule_namespace_selector\&amp;#34;\u003e\u003ccode\u003erule_selector\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel selector for \u003ccode\u003ePrometheusRule\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ccode\u003erule_selector\u003c/code\u003e \u0026gt; \u003ca href=\&amp;#34;#match_expression\&amp;#34;\u003e\u003ccode\u003ematch_expression\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eLabel match expression for \u003ccode\u003ePrometheusRule\u003c/code\u003e resources.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n              \u003ctd\u003e\u003ca href=\&amp;#34;#tls_config\&amp;#34;\u003e\u003ccode\u003etls_config\u003c/code\u003e\u003c/a\u003e\u003c/td\u003e\n              \u003ctd\u003eConfigure TLS settings for connecting to the endpoint.\u003c/td\u003e\n              \u003ctd\u003eno\u003c/td\u003e\n          \u003c/tr\u003e\n      \u003c/tbody\u003e\n    \u003c/table\u003e\n  \u003c/div\u003e\n\u003c/section\u003e&amp;#34;)&#34;&gt;
  &lt;noscript&gt;
    &lt;div class=&#34;config-app__noscript&#34;&gt;&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Block&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#authorization&#34;&gt;&lt;code&gt;authorization&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure generic authorization to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#basic_auth&#34;&gt;&lt;code&gt;basic_auth&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure &lt;code&gt;basic_auth&lt;/code&gt; for authenticating to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#extra_query_matchers&#34;&gt;&lt;code&gt;extra_query_matchers&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Additional label matchers to add to each query.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;extra_query_matchers&lt;/code&gt; &amp;gt; &lt;a href=&#34;#matcher&#34;&gt;&lt;code&gt;matcher&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;A label matcher to add to query.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#oauth2&#34;&gt;&lt;code&gt;oauth2&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure OAuth 2.0 for authenticating to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;oauth2&lt;/code&gt; &amp;gt; &lt;a href=&#34;#tls_config&#34;&gt;&lt;code&gt;tls_config&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure TLS settings for connecting to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#rule_selector-and-rule_namespace_selector&#34;&gt;&lt;code&gt;rule_namespace_selector&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label selector for &lt;code&gt;Namespace&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;rule_namespace_selector&lt;/code&gt; &amp;gt; &lt;a href=&#34;#match_expression&#34;&gt;&lt;code&gt;match_expression&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label match expression for &lt;code&gt;Namespace&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#rule_selector-and-rule_namespace_selector&#34;&gt;&lt;code&gt;rule_selector&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label selector for &lt;code&gt;PrometheusRule&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;rule_selector&lt;/code&gt; &amp;gt; &lt;a href=&#34;#match_expression&#34;&gt;&lt;code&gt;match_expression&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Label match expression for &lt;code&gt;PrometheusRule&lt;/code&gt; resources.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;a href=&#34;#tls_config&#34;&gt;&lt;code&gt;tls_config&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;Configure TLS settings for connecting to the endpoint.&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;
  &lt;/noscript&gt;
  &lt;main class=&#34;config-app__main&#34;&gt;
    &lt;template x3-if=&#34;flatBlocks.length === 0&#34;&gt;
      &lt;div class=&#34;empty-state&#34;&gt;
        &lt;div class=&#34;empty-state__icon&#34; x3-html=&#34;icons.AlertCircle&#34;&gt;&lt;/div&gt;
        &lt;p&gt;No valid configuration blocks found.&lt;/p&gt;
      &lt;/div&gt;
    &lt;/template&gt;

    &lt;template x3-if=&#34;flatBlocks.length &gt; 0&#34;&gt;
      &lt;div class=&#34;config-tree&#34;&gt;
        &lt;div class=&#34;config-tree__toolbar&#34;&gt;
          &lt;div class=&#34;config-tree__title&#34;&gt;&lt;/div&gt;
          &lt;button
            class=&#34;tree-explorer__button w-130 text-right&#34;
            x3-on:click=&#34;toggleExpandAll&#34;
            x3-bind:title=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;
          &gt;
            &lt;span x3-text=&#34;allExpanded ? &#39;Collapse all&#39; : &#39;Expand all&#39;&#34;&gt;&lt;/span&gt;
            &lt;svg class=&#34;api-icon&#34; viewBox=&#34;0 0 24 24&#34;&gt;
              &lt;path x3-show=&#34;!allExpanded&#34; d=&#34;m6 9 6 6 6-6&#34; /&gt;
              &lt;path x3-show=&#34;allExpanded&#34; d=&#34;m18 15-6-6-6 6&#34; /&gt;
            &lt;/svg&gt;
          &lt;/button&gt;
        &lt;/div&gt;

        &lt;div class=&#34;nodes-container&#34;&gt;
          &lt;template x3-for=&#34;block in flatBlocks&#34; x3-bind:key=&#34;block.id&#34;&gt;
            &lt;div class=&#34;node&#34; x3-bind:class=&#34;isNodeVisible(block) ? &#39;node--visible&#39; : &#39;node--hidden&#39;&#34;&gt;
              &lt;div
                class=&#34;node__row&#34;
                x3-bind:class=&#34;getRowClass(block)&#34;
                x3-bind:style=&#34;`padding-left: ${block.level * 24 &#43; 16}px`&#34;
                x3-on:click=&#34;toggleNode(block.id)&#34;
              &gt;
                &lt;div class=&#34;node__left&#34;&gt;
                  &lt;div class=&#34;node__indicator&#34;&gt;
                    &lt;template x3-if=&#34;block.hasChildren&#34;&gt;
                      &lt;button type=&#34;button&#34; class=&#34;node__toggle&#34; x3-on:click.stop=&#34;toggleNode(block.id)&#34;&gt;
                        &lt;div
                          class=&#34;node__toggle-icon&#34;
                          x3-bind:class=&#34;block.expanded ? &#39;node__toggle-icon--expanded&#39; : &#39;&#39;&#34;
                          x3-html=&#34;icons.ChevronDown&#34;
                        &gt;&lt;/div&gt;
                      &lt;/button&gt;
                    &lt;/template&gt;
                    &lt;template x3-if=&#34;!block.hasChildren&#34;&gt;
                      &lt;div class=&#34;node__toggle-spacer&#34;&gt;&lt;/div&gt;
                    &lt;/template&gt;
                  &lt;/div&gt;

                  &lt;div class=&#34;node__content&#34;&gt;
                    &lt;div
                      class=&#34;node__title prose&#34;
                      x3-bind:class=&#34;block.level === 0 ? &#39;node__title--root&#39; : &#39;node__title--nested&#39;&#34;
                      x3-html=&#34;block.displayName&#34;
                    &gt;&lt;/div&gt;
                    &lt;div class=&#34;node__description body-xsmall&#34; x3-html=&#34;block.description&#34;&gt;&lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;

                &lt;div class=&#34;node__meta&#34;&gt;
                  &lt;span
                    class=&#34;badge&#34;
                    x3-bind:class=&#34;block.required ? &#39;badge--required&#39; : &#39;badge--optional&#39;&#34;
                    x3-text=&#34;block.required ? &#39;Required&#39; : &#39;Optional&#39;&#34;
                  &gt;&lt;/span&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/template&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/template&gt;
  &lt;/main&gt;
&lt;/div&gt;

&lt;h3 id=&#34;authorization&#34;&gt;&lt;code&gt;authorization&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/authorization-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;credentials_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing the secret value.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;credentials&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Secret value.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;type&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Authorization type, for example, &amp;ldquo;Bearer&amp;rdquo;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;code&gt;credential&lt;/code&gt; and &lt;code&gt;credentials_file&lt;/code&gt; are mutually exclusive, and only one can be provided inside an &lt;code&gt;authorization&lt;/code&gt; block.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;credentials_file&lt;/code&gt; causes the file to be read on every outgoing request.
Use the &lt;code&gt;local.file&lt;/code&gt; component with the &lt;code&gt;credentials&lt;/code&gt; attribute instead to avoid unnecessary reads.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;h3 id=&#34;basic_auth&#34;&gt;&lt;code&gt;basic_auth&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/basic-auth-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;password_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing the basic auth password.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;password&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Basic auth password.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;username&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Basic auth username.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;code&gt;password&lt;/code&gt; and &lt;code&gt;password_file&lt;/code&gt; are mutually exclusive, and only one can be provided inside a &lt;code&gt;basic_auth&lt;/code&gt; block.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;password_file&lt;/code&gt; causes the file to be read on every outgoing request.
Use the &lt;code&gt;local.file&lt;/code&gt; component with the &lt;code&gt;password&lt;/code&gt; attribute instead to avoid unnecessary reads.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/div&gt;

        
&lt;h3 id=&#34;extra_query_matchers&#34;&gt;&lt;code&gt;extra_query_matchers&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;extra_query_matchers&lt;/code&gt; block has no attributes.
It contains zero or more [matcher][] blocks.
These blocks let you add extra label matchers to all queries that the &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; component discovers.
The algorithm of adding the label matchers to queries is the same as the one provided by the &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/command-line/promtool/#promtool-promql&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;promtool promql label-matchers set&lt;/code&gt; command&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;matcher&#34;&gt;&lt;code&gt;matcher&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;matcher&lt;/code&gt; block describes a label matcher that the component adds to each query in &lt;code&gt;PrometheusRule&lt;/code&gt; CRDs.&lt;/p&gt;
&lt;p&gt;You can use the following arguments:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;match_type&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The type of match. One of &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;=~&lt;/code&gt; and &lt;code&gt;!~&lt;/code&gt;.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Name of the label to match.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Value of the label to match.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;value_from_label&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Value of the Kubernetes &lt;code&gt;PrometheusRule&lt;/code&gt; label to match.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;Use only one of &lt;code&gt;value&lt;/code&gt; or &lt;code&gt;value_from_label&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;rule_selector-and-rule_namespace_selector&#34;&gt;&lt;code&gt;rule_selector&lt;/code&gt; and &lt;code&gt;rule_namespace_selector&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;rule_selector&lt;/code&gt; and &lt;code&gt;rule_namespace_selector&lt;/code&gt; blocks describe a Kubernetes label selector for rule or namespace discovery.&lt;/p&gt;
&lt;p&gt;You can use the following arguments:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;match_labels&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Label keys and values used to discover resources.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;{}&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When the &lt;code&gt;match_labels&lt;/code&gt; argument is empty, the component matches all resources.&lt;/p&gt;
&lt;h3 id=&#34;match_expression&#34;&gt;&lt;code&gt;match_expression&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;match_expression&lt;/code&gt; block describes a Kubernetes label match expression for rule or namespace discovery.&lt;/p&gt;
&lt;p&gt;You can use the following arguments:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The label name to match against.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;operator&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The operator to use when matching.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;yes&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;values&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;The values used when matching.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The &lt;code&gt;operator&lt;/code&gt; argument should be one of the following strings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;In&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;NotIn&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;Exists&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;DoesNotExist&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Don&amp;rsquo;t provide the &lt;code&gt;values&lt;/code&gt; argument when you set &lt;code&gt;operator&lt;/code&gt; to &lt;code&gt;&amp;quot;Exists&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;DoesNotExist&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;oauth2&#34;&gt;&lt;code&gt;oauth2&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/oauth2-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;client_id&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth2 client ID.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;client_secret_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;File containing the OAuth2 client secret.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;client_secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;OAuth2 client secret.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;endpoint_params&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Optional parameters to append to the token URL.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;no_proxy&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;map(list(secret))&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Specifies headers to send to proxies during CONNECT requests.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Use the proxy URL indicated by environment variables.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;proxy_url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;HTTP proxy to send requests through.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;scopes&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;list(string)&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;List of scopes to authenticate with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;token_url&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;URL to fetch the token from.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;&lt;code&gt;client_secret&lt;/code&gt; and &lt;code&gt;client_secret_file&lt;/code&gt; are mutually exclusive, and only one can be provided inside an &lt;code&gt;oauth2&lt;/code&gt; block.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;client_secret_file&lt;/code&gt; causes the file to be read on every outgoing request.
Use the &lt;code&gt;local.file&lt;/code&gt; component with the &lt;code&gt;client_secret&lt;/code&gt; attribute instead to avoid unnecessary reads.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;oauth2&lt;/code&gt; block may also contain a separate &lt;code&gt;tls_config&lt;/code&gt; sub-block.&lt;/p&gt;


&lt;div data-shared=&#34;reference/components/http-client-proxy-config-description.md&#34;&gt;
            &lt;p&gt;&lt;code&gt;no_proxy&lt;/code&gt; can contain IPs, CIDR notations, and domain names. IP and domain names can contain port numbers.
&lt;code&gt;proxy_url&lt;/code&gt; must be configured if &lt;code&gt;no_proxy&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_from_environment&lt;/code&gt; uses the environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (or the lowercase versions thereof).
Requests use the proxy from the environment variable matching their scheme, unless excluded by NO_PROXY.
&lt;code&gt;proxy_url&lt;/code&gt; and &lt;code&gt;no_proxy&lt;/code&gt; must not be configured if &lt;code&gt;proxy_from_environment&lt;/code&gt; is configured.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;proxy_connect_header&lt;/code&gt; should only be configured if &lt;code&gt;proxy_url&lt;/code&gt; or &lt;code&gt;proxy_from_environment&lt;/code&gt; are configured.&lt;/p&gt;
&lt;/div&gt;

        
&lt;/div&gt;

        
&lt;h3 id=&#34;tls_config&#34;&gt;&lt;code&gt;tls_config&lt;/code&gt;&lt;/h3&gt;


&lt;div data-shared=&#34;reference/components/tls-config-block.md&#34;&gt;
            &lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
              &lt;th&gt;Required&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ca_pem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;CA PEM-encoded text to validate the server with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;ca_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;CA certificate to validate the server with.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cert_pem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Certificate PEM-encoded text for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;cert_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Certificate file for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;insecure_skip_verify&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Disables validation of the server certificate.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;key_file&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Key file for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;key_pem&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;secret&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Key PEM-encoded text for client authentication.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;min_version&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Minimum acceptable TLS version.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;server_name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;ServerName extension to indicate the name of the server.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;no&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;The following pairs of arguments are mutually exclusive and can&amp;rsquo;t both be set simultaneously:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ca_pem&lt;/code&gt; and &lt;code&gt;ca_file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cert_pem&lt;/code&gt; and &lt;code&gt;cert_file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;key_pem&lt;/code&gt; and &lt;code&gt;key_file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When configuring client authentication, both the client certificate (using &lt;code&gt;cert_pem&lt;/code&gt; or &lt;code&gt;cert_file&lt;/code&gt;) and the client key (using &lt;code&gt;key_pem&lt;/code&gt; or &lt;code&gt;key_file&lt;/code&gt;) must be provided.&lt;/p&gt;
&lt;p&gt;When &lt;code&gt;min_version&lt;/code&gt; isn&amp;rsquo;t provided, the minimum acceptable TLS version is inherited from Go&amp;rsquo;s default minimum version, TLS 1.2.
If &lt;code&gt;min_version&lt;/code&gt; is provided, it must be set to one of the following strings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS10&amp;quot;&lt;/code&gt; (TLS 1.0)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS11&amp;quot;&lt;/code&gt; (TLS 1.1)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS12&amp;quot;&lt;/code&gt; (TLS 1.2)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;quot;TLS13&amp;quot;&lt;/code&gt; (TLS 1.3)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

        
&lt;h2 id=&#34;exported-fields&#34;&gt;Exported fields&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; doesn&amp;rsquo;t export any fields.&lt;/p&gt;
&lt;h2 id=&#34;component-health&#34;&gt;Component health&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; reports as unhealthy when given an invalid configuration or when an error occurs during reconciliation.&lt;/p&gt;
&lt;h2 id=&#34;debug-information&#34;&gt;Debug information&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; exposes resource-level debug information.&lt;/p&gt;
&lt;p&gt;The component exposes the following per discovered &lt;code&gt;PrometheusRule&lt;/code&gt; resource:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Kubernetes namespace.&lt;/li&gt;
&lt;li&gt;The resource name.&lt;/li&gt;
&lt;li&gt;The resource UID.&lt;/li&gt;
&lt;li&gt;The number of rule groups.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The component exposes the following per discovered Mimir rule namespace resource:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The namespace name.&lt;/li&gt;
&lt;li&gt;The number of rule groups.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The component only exposes resources it manages, regardless of how many actually exist.&lt;/p&gt;
&lt;h2 id=&#34;debug-metrics&#34;&gt;Debug metrics&lt;/h2&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Metric Name&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_rules_mimir_client_request_duration_seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;histogram&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Duration of requests to the Mimir API.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_rules_config_updates_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of configuration updates.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_rules_events_failed_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of events that failed processing, partitioned by event type.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_rules_events_retried_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of retried events, partitioned by event type.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;mimir_rules_events_total&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;counter&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Number of events processed, partitioned by event type.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;This example creates a &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; component that loads discovered rules to a local Mimir instance under the &lt;code&gt;team-a&lt;/code&gt; tenant.
The component only includes namespaces and rules with the &lt;code&gt;alloy&lt;/code&gt; label set to &lt;code&gt;yes&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;mimir.rules.kubernetes &amp;#34;local&amp;#34; {
    address = &amp;#34;mimir:8080&amp;#34;
    tenant_id = &amp;#34;team-a&amp;#34;

    rule_namespace_selector {
        match_labels = {
            alloy = &amp;#34;yes&amp;#34;,
        }
    }

    rule_selector {
        match_labels = {
            alloy = &amp;#34;yes&amp;#34;,
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This example creates a &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; component that loads discovered rules to Grafana Cloud.
It also adds a &lt;code&gt;&amp;quot;label1&amp;quot;&lt;/code&gt; label to each rule.
If that label already exists, the component overwrites it with &lt;code&gt;&amp;quot;value1&amp;quot;&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;mimir.rules.kubernetes &amp;#34;default&amp;#34; {
    address = &amp;#34;&amp;lt;GRAFANA_CLOUD_METRICS_URL&amp;gt;&amp;#34;
    basic_auth {
        username = &amp;#34;&amp;lt;GRAFANA_CLOUD_USER&amp;gt;&amp;#34;
        password = &amp;#34;&amp;lt;GRAFANA_CLOUD_API_KEY&amp;gt;&amp;#34;
        // Alternatively, load the password from a file:
        // password_file = &amp;#34;&amp;lt;GRAFANA_CLOUD_API_KEY_PATH&amp;gt;&amp;#34;
    }
    external_labels = {&amp;#34;label1&amp;#34; = &amp;#34;value1&amp;#34;}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This example adds label matcher &lt;code&gt;{cluster=~&amp;quot;prod-.*&amp;quot;}&lt;/code&gt; to all the queries discovered by &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;mimir.rules.kubernetes &amp;#34;default&amp;#34; {
    address = &amp;#34;&amp;lt;GRAFANA_CLOUD_METRICS_URL&amp;gt;&amp;#34;
    extra_query_matchers {
        matcher {
            name = &amp;#34;cluster&amp;#34;
            match_type = &amp;#34;=~&amp;#34;
            value = &amp;#34;prod-.*&amp;#34;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the component finds a query in the form of &lt;code&gt;up != 1&lt;/code&gt; in &lt;code&gt;PrometheusRule&lt;/code&gt; CRDs, it modifies the query to &lt;code&gt;up{cluster=~&amp;quot;prod-.*&amp;quot;} != 1&lt;/code&gt; before sending it to Mimir.&lt;/p&gt;
&lt;p&gt;This example shows a &lt;code&gt;PrometheusRule&lt;/code&gt; with a label set to &lt;code&gt;application.kubernetes.io/name=my-app&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    application.kubernetes.io/name: my-app&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following configuration extracts the value from the PrometheusRules CR label &lt;code&gt;application.kubernetes.io/name&lt;/code&gt; and adds a label matcher with the value &lt;code&gt;{app=~&amp;quot;extracted_value&amp;quot;}&lt;/code&gt; to all the queries discovered by the &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; component.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;mimir.rules.kubernetes &amp;#34;default&amp;#34; {
    address = &amp;#34;&amp;lt;GRAFANA_CLOUD_METRICS_URL&amp;gt;&amp;#34;
    extra_query_matchers {
        matcher {
            name = &amp;#34;app&amp;#34;
            match_type = &amp;#34;=&amp;#34;
            value_from_label = &amp;#34;application.kubernetes.io/name&amp;#34;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If the component finds a query in the form of &lt;code&gt;up != 1&lt;/code&gt; in &lt;code&gt;PrometheusRule&lt;/code&gt; CRDs, it modifies the query to &lt;code&gt;up{app=&amp;quot;my-app&amp;quot;} != 1&lt;/code&gt; before sending it to Mimir.&lt;/p&gt;
&lt;p&gt;This example demonstrates tenant federation.
The component treats rules defined in the &lt;code&gt;PrometheusRule&lt;/code&gt; CR as originating from &lt;code&gt;source-tenant-alpha&lt;/code&gt; and &lt;code&gt;source-tenant-beta&lt;/code&gt;.
The &lt;code&gt;mimir.rules.kubernetes&lt;/code&gt; component syncs these rules to the &lt;code&gt;target-tenant-main&lt;/code&gt; in the configured Mimir instance.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Alloy&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-alloy&#34;&gt;// config.alloy
mimir.rules.kubernetes &amp;#34;federated_rules&amp;#34; {
    address   = &amp;#34;mimir-ruler.example.com:8080&amp;#34;
    tenant_id = &amp;#34;target-tenant-main&amp;#34; // Target tenant in Mimir

    rule_selector {
        match_labels = {
            &amp;#34;federation-group&amp;#34; = &amp;#34;group1&amp;#34;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;# prometheus-rule-federated.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: federated-app-rules
  namespace: my-apps
  labels:
    federation-group: &amp;#34;group1&amp;#34;
  annotations:
    monitoring.grafana.com/source_tenants: &amp;#34;source-tenant-alpha,source-tenant-beta&amp;#34;
spec:
  groups:
  - name: my.app.rules
    rules:
    - alert: HighErrorRateFederated
      expr: job:request_latency_seconds:mean5m{job=&amp;#34;my-federated-app&amp;#34;} &amp;gt; 0.5
      for: 10m
      labels:
        severity: critical
      annotations:
        summary: High request error rate for my-federated-app&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following example is an RBAC configuration for Kubernetes.
It authorizes Alloy to query the Kubernetes REST API:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;apiVersion: v1
kind: ServiceAccount
metadata:
  name: alloy
  namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: alloy
rules:
- apiGroups: [&amp;#34;&amp;#34;]
  resources: [&amp;#34;namespaces&amp;#34;]
  verbs: [&amp;#34;get&amp;#34;, &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34;]
- apiGroups: [&amp;#34;monitoring.coreos.com&amp;#34;]
  resources: [&amp;#34;prometheusrules&amp;#34;]
  verbs: [&amp;#34;get&amp;#34;, &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34;]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: alloy
subjects:
- kind: ServiceAccount
  name: alloy
  namespace: default
roleRef:
  kind: ClusterRole
  name: alloy
  apiGroup: rbac.authorization.k8s.io&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="mimirruleskubernetes">&lt;code>mimir.rules.kubernetes&lt;/code>&lt;/h1>
&lt;p>&lt;code>mimir.rules.kubernetes&lt;/code> discovers &lt;code>PrometheusRule&lt;/code> Kubernetes resources and loads them into a Mimir instance.&lt;/p>
&lt;p>It can also &lt;a href="/docs/mimir/latest/references/architecture/components/ruler/#federated-rule-groups">federate rules&lt;/a> from different source tenants into a target Mimir tenant by interpreting the &lt;code>monitoring.grafana.com/source_tenants&lt;/code> annotation on &lt;code>PrometheusRule&lt;/code> resources.&lt;/p></description></item></channel></rss>