<p>I'm attempting to mount a filepath into my datadog agent container, which is being provisioned into a kubernetes cluster via <a href="https://artifacthub.io/packages/helm/datadog/datadog" rel="nofollow noreferrer">Datadog Helm Chart.</a></p>
<p>I'm using <code>agents.volumes</code> value to pass in. which the docs describe as &quot;Specify additional volumes to mount in the dd-agent container&quot;.</p>
<p>Based on the syntax found in the <a href="https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml#L1151-L1156" rel="nofollow noreferrer">Datadog/helm-charts repo</a> - I'm using:</p>
<pre><code>  agents:
    volumes:
      - hostPath:
          path: /var/log/cloud-init.log
        name: cloud-init
</code></pre>
<p>But when I apply that change to my cluster, I don't see any evidence that this path has been mounted anywhere on my agent container. I'm not seeing any great explanation of mount a volume from my host container into the datadog agent container.</p>

<p>I see that value is only used to declare the volumes on the DaemonSet pod definition, not to mount them.</p>
<p><code>agents.volumes</code> is for defining custom volumes on the agent but this is used on the DaemonSet definition, specifically on <code>spec.template.spec.volumes</code> <a href="https://github.com/DataDog/helm-charts/blob/main/charts/datadog/templates/daemonset.yaml#L154-L156" rel="nofollow noreferrer">look here</a>.</p>
<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: {{ template &quot;datadog.fullname&quot; . }}
  namespace: {{ .Release.Namespace }}
  ...
spec:
    ...
    spec:
      ...
      volumes:
      ...
{{- if .Values.agents.volumes }}
{{ toYaml .Values.agents.volumes | indent 6 }}
{{- end }}
</code></pre>
<p>To actually use those volumes you have to define  the variable <a href="https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml#L1165-L1168" rel="nofollow noreferrer"><code>agents.volumeMounts</code></a> which is used <a href="https://github.com/DataDog/helm-charts/blob/4c1b07ea55833e40b3bfce45dd774edfdbf126ce/charts/datadog/templates/_container-agent.yaml#L190-L192" rel="nofollow noreferrer">here</a>.</p>
<pre><code>{{- define &quot;container-agent&quot; -}}
- name: agent
  image: &quot;{{ include &quot;image-path&quot; (dict &quot;root&quot; .Values &quot;image&quot; .Values.agents.image) }}&quot;
  ...
  volumeMounts:
    ...
{{- if .Values.agents.volumeMounts }}
{{ toYaml .Values.agents.volumeMounts | indent 4 }}
{{- end }}
...
{{- end -}}
</code></pre>
<p>So you most likely want to define your values like this:</p>
<pre><code>agents:
  volumes:
    - hostPath:
        path: /var/log/cloud-init.log
      name: cloud-init
  volumeMounts:
    - name: cloud-init
      mountPath: /some/path
      readOnly: true
</code></pre>
