Closed sttrayno closed 4 years ago
The /etc/telegraf
directory is read only because this Helm chart mounts over the top of it:
Whenever I try to copy or clone files into the etc directory of the container
I don't understand this. When / how are you doing this?
Hi David,
That makes sense now I knew I was missing something.
To try explain myself a bit better, I'm trying to get the chart to use my own container which at build time copies some .conf files I've built into the telegraf.d directory. Looked fine on my machine but every time the container started with helm they weren't there, I wasn't sure why that was happening but you'd now explained it.
This was my values.yaml file
image:
repo: "sttrayno/telegraf-connector"
tag: "0.1"
pullPolicy: Always
outputs:
- influxdb:
urls:
- "http://influxdb.sttrayno-dev:8086"
database: "telegraf"
Is there anyway to be able to write to the /etc/telegraf directory? or should I be looking for another way to achieve this?
Unfortunately this chart won't support this use case, but I think it should.
I can describe what needs to happen, if you'd like to have a go at a PR; or I can find some time over the next few days to make the change.
Whatever you prefer is good with me
Happy to give it a shot, I'm a novice picking this stuff up
Hey @sttrayno
I forgot I actually added something like this recently 😃
# volumes:
# - name: telegraf-output-influxdb2
# configMap:
# name: "telegraf-output-influxdb2"
# mountPoints:
# - name: telegraf-output-influxdb2
# mountPath: /etc/telegraf/conf.d
# subPath: influxdb2.conf
You can add your own config volume with a manual config.
@rawkode this doesn't actually work, there is no sub dir in /etc/telegraf and the filesystem is read-only still
Error: failed to create containerd task: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "/var/lib/kubelet/pods/5b689fe9-6313-4ec1-ad39-3ec08d3394f3/volume-subpaths/telegraf-input-snmp-edgemax/telegraf/1" to rootfs at "/run/k3s/containerd/io.containerd.runtime.v2.task/k8s.io/telegraf/rootfs/etc/telegraf/telegraf.d" caused: not a directory: unknown
@cnf please provide a values file for me to reproduce and I’ll work it out
Hi @rawkode
The value file from this repo (https://github.com/influxdata/helm-charts/blob/master/charts/telegraf/values.yaml#L28) will reproduce this issue.
Uncomment line 28 to 35
volumes:
- name: telegraf-output-influxdb2
configMap:
name: "telegraf-output-influxdb2"
mountPoints:
- name: telegraf-output-influxdb2
mountPath: /etc/telegraf/conf.d
subPath: influxdb2.conf
create a config map, and deploy helm
touch influxdb2.conf
kubectl create configmap telegraf-output-influxdb2 --from-file=influxdb2.conf
helm upgrade --install -f local-values.yaml telegraf-mount-test influxdata/telegraf
Thanks!
Hi,
First off massive thank you for these charts, they've got me into using helm and have been a massive help.
I've been having an issue with the chart for telegraf, I'm using custom docker container as I have quite a complex telegraf config and need to install some packages so
Whenever I try to copy or clone files into the etc directory of the container I'm hit with an error that the /etc directory is a read only filesystem. I've verified this by doing an exec into the container. I'm able to clone or copy files into other directories such as root, just not the etc.
I'm assuming I'm missing something, but can't see anything in the configs or values thats /etc or filesystem specific.
When I deploy the container manually with kubectl all works as expected so I'm pretty sure I've narrowed it down to the helm chart.
Many thanks!