Run telegraf as daemonset

5/7/2019

I would like to run telegraf as daemonset but it complains about volumemounts.

I've followed this article to create my kubernetes cluster.

Now try to follow this article to setup telegraf metrics sendings to our kafka endpoint.

This is my yaml configuration.

When I try to run kubectl apply -f /tmp/telegraf.yaml I got this error:

configmap/telegraf unchanged
The DaemonSet "telegraf" is invalid:
* spec.template.spec.containers[0].volumeMounts[1].name: Not found: "docker"
* spec.template.spec.containers[0].volumeMounts[3].mountPath: Invalid value: "/var/run/docker.sock": must be unique

What is the issue to move forward?

-- Badb0y
daemonset
kubernetes
metrics
telegraf

2 Answers

5/7/2019

I suggest trying the official telegraf-ds chart: https://github.com/influxdata/tick-charts/tree/master/telegraf-ds. They maintain it, so no need to re-implement yourself. Just override the config to send to kafka.

Note that they never merged it to stable so helm install stable/telegraf-ds won't work. Just clone the repo and install from source, or package yourself and put somewhere.

-- Max Lobur
Source: StackOverflow

5/7/2019

Remove these lines from manifest:

- name: docker
  mountPath: /var/run/docker.sock
  readOnly: true
-- Vasily Angapov
Source: StackOverflow