Agents.volumes 参数在 Datadog Helm Chart 中如何工作

发布于 2025-01-18 06:15:23 字数 670 浏览 2 评论 0 原文

我正在尝试将文件路径安装到我的 datadog 代理容器中,该容器正在通过 Datadog Helm Chart。

我使用 agents.volumes 值来传递。文档将其描述为“指定要在 dd-agent 容器中安装的其他卷”。

基于 Datadog 中找到的语法/helm-charts repo - 我正在使用:

  agents:
    volumes:
      - hostPath:
          path: /var/log/cloud-init.log
        name: cloud-init

但是当我将该更改应用于我的集群时,我没有看到任何证据表明该路径已安装在我的代理上的任何位置 容器。我没有看到任何关于将主机容器中的卷安装到 datadog 代理容器中的详细解释。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヅ她的身影、若隐若现 2025-01-25 06:15:23

我看到该值仅用于声明Daemonset Pod定义上的卷,而不是安装它们。

代理用于定义代理上的自定义卷,但这用于Daemonset定义,特别是在 spec.template.spec.spec.volumes 在这里查看

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 }}

要实际使用这些量,您必须定义变量agents.volumeMounts which is used

{{- 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 -}}

因此,您很可能想定义您的价值观:

agents:
  volumes:
    - hostPath:
        path: /var/log/cloud-init.log
      name: cloud-init
  volumeMounts:
    - name: cloud-init
      mountPath: /some/path
      readOnly: true

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文