How to enable dashboards for metricbeat in kubernetes daemonset environment


(Ji Ho Choi) #1

I currently have a default daemonset settings from elastic stack like below
It's what I have copied off from https://github.com/elastic/beats/tree/master/deploy/kubernetes/metricbeat

I would like to import default dashboards to kibana when beats start running so I added setup.kibana.host: "kibana ip" but it is not adding default dashboards and kibana keeps saying that it is not receving metrics. However, metrics are being sent to elasticsearch just fine under metricbeat* and I can see that it is coming in in kibana. How do I setup default dashboards when I deploy daemonset in kubernetes? I've not pasted in RBACs and Daemonset as it exceeded the word limit but my settings are exactly the same as the link above except I'm using OSS version and added kibana host

apiVersion: v1
kind: ConfigMap
metadata:
  name: metricbeat-daemonset-config
  namespace: kube-logging
  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
    # To enable hints based autodiscover uncomment this:
    #metricbeat.autodiscover:
    #  providers:
    #    - type: kubernetes
    #      host: ${NODE_NAME}
    #      hints.enabled: true
    processors:
      - add_cloud_metadata:
    cloud.id: ${ELASTIC_CLOUD_ID}
    cloud.auth: ${ELASTIC_CLOUD_AUTH}
    output.elasticsearch:
      hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
      username: ${ELASTICSEARCH_USERNAME}
      password: ${ELASTICSEARCH_PASSWORD}
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: metricbeat-daemonset-modules
  namespace: kube-logging
  labels:
    k8s-app: metricbeat
data:
  kubernetes.yml: |-
    - module: kubernetes
      metricsets:
        - node
        - system
        - pod
        - container
        - volume
      period: 10s
      host: ${NODE_NAME}
      hosts: ["localhost:10255"]
      # If using Red Hat OpenShift remove the previous hosts entry and
      # uncomment these settings:
      #hosts: ["https://${HOSTNAME}:10250"]
      #bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
      #ssl.certificate_authorities:
        #- /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt

    - module: kubernetes
      enabled: true
      metricsets:
        - state_node
        - state_deployment
        - state_replicaset
        - state_statefulset
        - state_pod
        - state_container
      period: 10s
      hosts: ["kube-state-metrics:8080"]

      # Enriching parameters:
      add_metadata: true
      in_cluster: true
      # When used outside the cluster:
      #host: node_name
      #kube_config: ~/.kube/config

    # Kubernetes events
    - module: kubernetes
      enabled: true
      metricsets:
        - event

    # Kubernetes API server
    - module: kubernetes
      enabled: true
      metricsets:
        - apiserver
      hosts: ["https://${KUBERNETES_SERVICE_HOST}:${KUBERNETES_SERVICE_PORT}"]

(Jaime Soriano) #2

Hi @Ji_Ho_Choi,

The reference settings for Kubernetes don't setup the dashboards, but you can run metricbeat setup --dashboard from any machine with access to your Kibana instance, for example from your work station.