Telegraf for k8s collection data ERR

[inputs.kubernetes] Error in plugin: returned HTTP status 403 Forbidden

deploy telegraf in k8s,the config is that

  url = ""
  bearer_token = "/var/run/secrets/"
  insecure_skip_verify = true

i have try change to but also ERR

and /var/run/secrets/ is right

k8s version v1.20.6 telegraf 1.20

Hi @Dhongwei,
I believe your issue could be related to this open issue: Kubernetes input plugin not working (deprecated /stats/summary endpoint?) · Issue #6959 · influxdata/telegraf · GitHub
. It appears that most are working around the issue by using the Telegraf DaemonSet: helm-charts/charts/telegraf-ds at master · influxdata/helm-charts · GitHub. I will reraise this with the Telegraf team for further investigation around the kubernetes plugin.

Hi @Dhongwei,
I spoke with the team. They have also asked if you have tried creating a Service Account and ClusterRoleBinding for telegraf using the yaml configuration below. Mind the namespace.

apiVersion: v1
kind: ServiceAccount
  name: telegraf
kind: ClusterRoleBinding
  name: metric-scanner-kubelet-api-admin
- kind: ServiceAccount
  name: telegraf
  namespace: influxdb
  kind: ClusterRole
  name: system:kubelet-api-admin

Thank you very much. I just wrote this ymal wrong
My problem has been solved Thank you for your help

1 Like