<p>I have a small problem with the labels to put in my pods.
I use an EKS cluster and I followed the instructions to set up the Datadog APM. In the tutorial at <a href="https://app.datadoghq.com/apm/docs?architecture=container-based" rel="nofollow noreferrer">this address</a>.</p>
<p>It is indicated to put these labels in my deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment

labels:
  tags.datadoghq.com/env: &quot;&lt;environment&gt;&quot;
  tags.datadoghq.com/service: &quot;&lt;service&gt;&quot;
  tags.datadoghq.com/version: &quot;&lt;version&gt;&quot;
</code></pre>
<p>And these environment variables (in the container spec):</p>
<pre><code>env :
        - name : DD_AGENT_HOST
          valeurFrom :
            fieldRef :
              fieldPath : status.hostIP
        - nom : DD_ENV
          valeurFrom :
            fieldRef :
              fieldPath : metadata.labels['tags.datadoghq.com/env']
        - nom : DD_SERVICE
          valeurFrom :
            fieldRef :
              fieldPath : métadonnées.labels['tags.datadoghq.com/service']
        - nom : DD_VERSION
          valeurFrom :
            fieldRef :
              fieldPath : metadata.labels['tags.datadoghq.com/version']
</code></pre>
<p>What I did, however, in my pod these environment variables are empty, by moving these environment variables into labels in <code>spec -&gt; template -&gt; metadata -&gt; labels</code> it works fine, my environment variables are well filled when I check in my pod
But this is not good since in my CI at each update of my app I have to change the <code>tags.datadoghq.com/version label: &quot;&lt;version&gt;&quot;</code> and this only makes sense if it is a deployment label and that's why in my opinion in the doc it says to put these labels at the deployment level, but it doesn't work, do you have any idea how to do it, I really looked a lot but I can't find anything.</p>

<p>So the solution is the following:
Don't put the labels at the deployment level (as indicated in the Datadog doc) and put them at the <strong>Pod Template</strong> level (<code>spec -&gt; template -&gt; metadata -&gt; labels</code>). Concerning the update of the labels you have to launch the following command:</p>
<pre><code>$ kubectl patch deployment/myDeployment --patch '{&quot;spec&quot;: {&quot;template&quot;: {&quot;metadata&quot;: {&quot;labels&quot;: {&quot;tags.datadoghq.com/version&quot;: &quot;myVersionValue&quot;}}}}}'
</code></pre>
