Metricbeat failing autodiscover on Kubernetes

9/3/2018

Autodiscover not working for metricbeat 6.4.0 in kubernetes 1.9.6. Nginx module in this use case, uwsgi also tried. Declaring the module and giving an nginx ip outside of autodiscover works. below is the configmap being used. Any ideas on some additional ways to set this up or problems that would stop the autodiscover from working.

apiVersion: v1
kind: ConfigMap
metadata:
  name: metricbeat-deployment-config
  namespace: kube-system
  labels:
    k8s-app: metricbeat
data:
  metricbeat.yml: |-
    metricbeat.config.modules:
      # Mounted `metricbeat-daemonset-modules` configmap:
      path: ${path.config}/modules.d/*.yml
      # Reload module configs as they change:
      reload.enabled: false

    processors:
      - add_cloud_metadata:

    output.elasticsearch:
      hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: metricbeat-deployment-modules
  namespace: kube-system
  labels:
    k8s-app: metricbeat
data:
  autodiscover.yml: |-
    metricbeat.autodiscover:
      providers:
        - type: kubernetes
          host: ${HOSTNAME}
          #hints.enabled: true
          templates:
            - condition:
                contains:
                  kubernetes.container.name: nginx
              config:
                - module: nginx
                  metricsets: ["stubstatus"]
                  enable: true
                  period: 10s
                  hosts: ["${data.host}:80"]
                  server_status_path: "nginx_status"

  kubernetes.yml: |-
    - module: kubernetes
      metricsets:
        - state_node
        - state_deployment
        - state_replicaset
        - state_pod
        - state_container
      period: 10s
      host: ${NODE_NAME}
      hosts: ["kube-state-metrics.monitoring.svc:8080"]
-- the_frank
autodiscovery
kubernetes
metricbeat
nginx

0 Answers