I'm attempting to mount a filepath into my datadog agent container, which is being provisioned into a kubernetes cluster via Datadog Helm Chart.
I'm using agents.volumes
value to pass in. which the docs describe as "Specify additional volumes to mount in the dd-agent container".
Based on the syntax found in the Datadog/helm-charts repo - I'm using:
agents:
volumes:
- hostPath:
path: /var/log/cloud-init.log
name: cloud-init
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.
I see that value is only used to declare the volumes on the DaemonSet pod definition, not to mount them.
agents.volumes
is for defining custom volumes on the agent but this is used on the DaemonSet definition, specifically on spec.template.spec.volumes
look here.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
...
spec:
...
spec:
...
volumes:
...
{{- if .Values.agents.volumes }}
{{ toYaml .Values.agents.volumes | indent 6 }}
{{- end }}
To actually use those volumes you have to define the variable agents.volumeMounts
which is used here.
{{- define "container-agent" -}}
- name: agent
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
...
volumeMounts:
...
{{- if .Values.agents.volumeMounts }}
{{ toYaml .Values.agents.volumeMounts | indent 4 }}
{{- end }}
...
{{- end -}}
So you most likely want to define your values like this:
agents:
volumes:
- hostPath:
path: /var/log/cloud-init.log
name: cloud-init
volumeMounts:
- name: cloud-init
mountPath: /some/path
readOnly: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With