<p>i am struggling to create a custom subject when receiving alerts from my AlertManager, i am doing it with manifest file:</p>
<pre><code>apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: my-name
  labels:
    alertmanagerConfig: email
    alertconfig: email-config
spec:
  route:
    groupBy:
      - node
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: 'myReceiver'
  receivers:
  - name: 'Name'
    emailConfigs:
      - to: myemail@example.com
</code></pre>
<p>i have read that i need to add headers under the emailConfigs tab, but when i do like follows:</p>
<pre><code>apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: my-name
  labels:
    alertmanagerConfig: email
    alertconfig: email-config
spec:
  route:
    groupBy:
      - node
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: 'myReceiver'
  receivers:
  - name: 'Name'
    emailConfigs:
      - to: myemail@example.com
        headers:
          - subject: &quot;MyTestSubject&quot;
</code></pre>
<p>or</p>
<pre><code>apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: my-name
  labels:
    alertmanagerConfig: email
    alertconfig: email-config
spec:
  route:
    groupBy:
      - node
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: 'myReceiver'
  receivers:
  - name: 'Name'
    emailConfigs:
      - to: myemail@example.com
        headers:
          subject: &quot;MyTestSubject&quot;
</code></pre>
<p>I receive following errors:</p>
<p>either:</p>
<p>com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers.emailConfigs.headers, ValidationError(AlertmanagerConfig.spec.receivers[0].emailConfigs[0].headers[0]): missing required field &quot;key&quot; in com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers.emailConfigs.headers, ValidationError(AlertmanagerConfig.spec.receivers[0].emailConfigs[0].headers[0]): missing required field &quot;value&quot; in com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers.emailConfigs.headers];</p>
<p>or</p>
<p>error: error validating &quot;alert-config.yaml&quot;: error validating data: ValidationError(AlertmanagerConfig.spec.receivers[0].emailConfigs[0].headers): invalid type for com.coreos.monitoring.v1alpha1.AlertmanagerConfig.spec.receivers.emailConfigs.headers: got &quot;map&quot;, expected &quot;array&quot;</p>
<p>i have checked other solutions and everyone is doing it like
headers:
subject: mySubject<br />
but for some reason to me, it doesn't work</p>

Blackhat
<p>Hi @Blackcat from this <a href="https://www.suse.com/c/wp-content/uploads/2021/09/rancher_blog_07-rancher-alertmanager-status-tab.png" rel="nofollow noreferrer">example</a> I found that you might need to use Catipal 'S' for the subject under headers looks like we need to use first letter capital for the keys under headers like mentioned below.</p>
<pre><code>apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: my-name
  labels:
    alertmanagerConfig: email
    alertconfig: email-config
spec:
  route:
    groupBy:
      - node
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: 'myReceiver'
  receivers:
  - name: 'Name'
    emailConfigs:
      - to: myemail@example.com
        headers:
          Subject: &quot;MyTestSubject&quot;
          From: Me
          To: You
</code></pre>
<p>For more detailed information check this <a href="https://www.suse.com/c/rancher_blog/custom-alerts-using-prometheus-queries/" rel="nofollow noreferrer">link</a></p>
