I am trying to include multiple configuration files in a telegraf pod in Kubernetes.
This is my current yaml file with one config file to deploy telegraf on Kubernetes and it works just fine.
But when I try to map multiple config files into the telegraf pod nothing works anymore.
In fact the files get mapped into the pod but telegraf doesn’t use them.
I’d like to know if there is a way to map multiple config files into the telegraf pod.
The telegraf container does not use the /etc/telegraf/telegraf.d directory by default. You would need to add that as an option to your telegraf command to include --config-directory /etc/telegraf/telegraf.d
Let me know if that helps or if you are somehow running Telegraf differently such that it is already trying to include that folder.
I tried to include it only with the args: lable and also with the command and the args lable.
In both scenarios the pod directly goes into completed state and after a few minutes it goes to CrashLoopBackOff.
When I don’t use the --config-directory flag the pod starts and keeps running but won’t send metrics to influx. Not even the main file will work, although it worked before I mapped the other config files into the config-folder.
I don’t know if it is possible to run telegraf in a pod with multiple config files or if my yaml file is just wrong.
I found the problem and now it is working.
The problem was, that I had to pass the flag --config-directory as two arguments and you can use the keywords volumes and volumeMounts only once but you can specify more sources than one.