Help ! ERROR : util/kubernetes.go:114 Error initializing Kubernetes metadata enricher: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

I run metricbeat in docker in k3s environment and I got an error.
"ERROR util/kubernetes.go:114 Error initializing Kubernetes metadata enricher: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"

my configuration:
metrics.yml

- module: kubernetes
  metricsets:
    - pod
  period: 5s
  enabled: true
  hosts: ["https://k3s_thriver.metricbeat.com:10250"]
  bearer_token_file: /hostfs/etc/rancher/k3s/token
  ssl.verification_mode: "none"
  
  fields_under_root: true
  fields:
    environment: "Cluster"
    application: "k3s"
    server_group: "cor"
    object: "K3S Metrics"
    ci_hint: ""
    source_hint: ""
    eti_hint: ''
    kb_link: ''
    application_dashboard: ''
    node_detail_dashboard: ''

what is the issue? any help I will appreciate. Thanks in advance.

Hello,

It doesn't seem to be an error with the ECK, it's more like a Kubernetes issue.
If you look closer at the error message, it says:

unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable

Did you try to specify the KUBERNETES_MASTER environment variable? Again, this is not an ECK/Elasticsearch issue, feel free to open an issue/question on the Kubernetes discuss https://discuss.kubernetes.io/

I used to define it. Guess what, I just didn't put a "-" and whitespaces mistake when I defined the env. No wonder I can't get it right

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.