Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telegraf.d folder and kubernetes config-maps, cause plugins to load 2x #4133

Closed
puckpuck opened this issue May 10, 2018 · 1 comment
Closed

Comments

@puckpuck
Copy link
Contributor

I'm deploying telegraf within a Kubernetes pod, and using config maps to put plugins in the /etc/telegraf/telegraf.d folder. The way Kubernetes does config maps, is you file is placed in the folder as a link to a file in a subfolder, linked to another actual folder which contains your file. Somehow this causes telegraf to load my file 2x, and thus my plugin is configured to run 2x.

Here is the output from doing ls -la on the telegraf.d folder after the config map is mounted:

/etc/telegraf/telegraf.d # ls -la
total 4
drwxrwxrwt    3 root     root           100 May 10 01:53 .
drwxr-xr-x    1 root     root          4096 May 10 01:53 ..
drwxr-xr-x    2 root     root            60 May 10 01:53 ..2018_05_10_01_53_36.330728263
lrwxrwxrwx    1 root     root            31 May 10 01:53 ..data -> ..2018_05_10_01_53_36.330728263
lrwxrwxrwx    1 root     root            22 May 10 01:53 prometheus.conf -> ..data/prometheus.conf
/etc/telegraf/telegraf.d # ls ..2018_05_10_01_53_36.330728263/
prometheus.conf
/etc/telegraf/telegraf.d # 

When telegraf starts up I can see the input plugin is loaded 2x

2018-05-10T01:53:42Z I! Loaded outputs: wavefront
2018-05-10T01:53:42Z I! Loaded inputs: inputs.prometheus inputs.prometheus
2018-05-10T01:53:42Z I! Tags enabled: host=kube-state-metrics
2018-05-10T01:53:42Z I! Agent Config: Interval:1m0s, Quiet:false, Hostname:"kube-state-metrics", Flush Interval:1m0s 

Ideally telegraf does not load any hidden file, or file that starts with a period . when loading files from the config-directory.

For reference here is my Kubernetes yaml that defines the deployment, and config map.

# Kubernetes versions after 1.9.0 should use apps/v1
# Kubernetes versions before 1.8.0 should use apps/v1beta1 or extensions/v1beta1
kind: Deployment
metadata:
  name: telegraf-ksm
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: telegraf-ksm
  template:
    metadata:
      labels:
        app: telegraf-ksm
    spec:
      containers:
      - name: telegraf
        image: puckpuck/wavefront-telegraf
        env:
        - name: WAVEFRONT_PROXY
          value: wavefront-proxy.default
        - name: INTERVAL
          value: 60s
        - name: METRIC_SOURCE_NAME
          value: kube-state-metrics
        resources:
          requests:
            memory: 30Mi
            cpu: 100m
          limits:
            memory: 50Mi
            cpu: 200m
        volumeMounts:
        - name: telegraf-d
          mountPath: /etc/telegraf/telegraf.d
      volumes:
      - name: telegraf-d
        projected:
          sources:
          - configMap:
              name: telegraf-ksm-config
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: telegraf-ksm-config
  namespace: kube-system
data:
  prometheus.conf: |
    [[inputs.prometheus]]
      urls = ["http://kube-state-metrics:8080/metrics"]
@puckpuck
Copy link
Contributor Author

I guess I should of looked at the source first, realized it was fixed, and found the PR from 28 days ago. #3999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant