<p>I'm trying to automatically annotate pods (edit: ingress controller pods) to set a custom logs parser in Scalyr when running helm chart packed containers on Azure AKS. I can annotate the service automatically, but fail to annotate pods automatically. Using kubectl to manually do this:</p>
<pre><code>kubectl annotate pod nginx-ingress-ingress-nginx-controller-yyy-xxx --overwrite log.config.scalyr.com/attributes.parser=&lt;my_scalyr_parser_name&gt;
</code></pre>
<p>is fine, but when my pods would terminate, then I'll lose my annotations and Scalyr might be missing some logs. Or are ingress nginx pods IDDQD (immortal)? So I'm trying to automate this somehow.</p>
<p>I have tried adding it to values.yaml</p>
<pre><code>ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    log.config.scalyr.com/attributes.parser: &quot;&lt;my_scalyr_parser_name&gt;&quot;
</code></pre>
<p>but it just lands in metadata annotations in ingress.yaml</p>
<pre><code>kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include &quot;myservice.labels&quot; . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
</code></pre>
<p>and this results in annotations of the service. However, I need annotation on pods for Scalyr to use my custom parser, not in the service.</p>
<p>Another approach would be to do it by hard when installing nginx-ingress:</p>
<pre><code>helm install nginx-ingress ingress-nginx/ingress-nginx --set controller.replicaCount=3 --set-string controller.pod.annotations.'log\.config\.scalyr\.com/attributes\.parser'=&quot;&lt;my_scalyr_parser_name&gt;&quot;
--set-string controller.service.annotations.'service\.beta\.kubernetes\.io/azure-load-balancer-internal'=&quot;true&quot; 
</code></pre>
<p>there when I'm setting controller.service.annotations I get annotation on the service, but controller.pod.annotations are ignored (and I found controller.pod.annotations in nginx documentation).</p>
<p>So what else could I do?</p>

<p>You should be able to do it with the <code>values.yaml</code>, in a similar way you tried for <code>ingress</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>controller:
  podAnnotations:
    log.config.scalyr.com/attributes.parser: &quot;&lt;my_scalyr_parser_name&gt;&quot;
</code></pre>
<p>For some reason, the key of the variable is <code>controller.podAnnotations</code> NOT <code>controller.pod.annotations</code></p>
