# Metricbeat in Kubernetes - 404 error for Kubernetes module events

**URL:** <https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [May 17, 2019, 8:37pm UTC](https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653 "2019-05-17T20:37:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)\
**Post date:** [May 17, 2019, 8:37pm UTC](https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653/1 "2019-05-17T20:37:31Z")

</div>

Hello,

I am running Metricbeat 7.0.1 on Kubernetes cluster (Server V1.14), followed the official [instructions](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-kubernetes.html), and enabled System, Docker, Kubernetes modules. System and Docker modules working where I can see the data in Kibana (Discover and Dashboards). But for all Kubernetes events I am getting the following error.message  
`HTTP error 404 in : 404 Not Found`

Following is my Kubernetes module config

```
- module: kubernetes
  period: 10s
  enabled: true
  metricsets:
    - container
    - node
    - pod
    - system
    - volume
  host: ${NODE_NAME}
  hosts: ["https://${KUBE_HOST}"]
  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  ssl.certificate_authorities:
    - /var/run/secrets/kubernetes.io/serviceaccount/ca.crt

```

where KUBE\_HOST is `192.168.200.75:6443` which I got this info from executing the following command

```
>kubectl cluster-info
Kubernetes master is running at https://192.168.200.75:6443

```

Serviceaccount config

```
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: metricbeat
subjects:
- kind: ServiceAccount
  name: metricbeat
  namespace: dev
roleRef:
  kind: ClusterRole
  name: metricbeat
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: metricbeat
  labels:
    app: metricbeat
rules:
- apiGroups: [""]
  resources:
  - nodes
  - namespaces
  - events
  - pods  
  verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
  resources:
  - replicasets
  verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
  resources:
  - statefulsets
  - deployments
  verbs: ["get", "list", "watch"]
- apiGroups:
  - ""
  resources:
  - nodes/stats
  - nodes/metrics
  verbs:
  - get
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: metricbeat
  namespace: dev
  labels:
    app: metricbeat
---

```

Initially I was getting `HTTP error 403 in : 403 Forbidden` error in the events, then I changed the ClusterroleBinding.roleref.name to "cluster-admin" temporarily so that metricbeat will access Kubernetes with cluster-admin role, now I am getting 404 error.

Do I need to configure anything in metricbeat or Kubernetes to get the metrics?

Thanks

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [May 28, 2019, 6:04pm UTC](https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653/2 "2019-05-28T18:04:02Z")

</div>

@chandra2037 Sorry for the late response here. So you are trying to use k8s module in metricbeat to get metrics from the k8s cluster that metricbeat is running on? My first guess is `hosts: ["https://${KUBE_HOST}"]` should be pointing to `hosts: ["localhost:10255"]`. Also maybe [Kubernetes data collection error with metricbeat!](https://discuss.elastic.co/t/kubernetes-data-collection-error-with-metricbeat/143511) will help!

---

<div class="post-metadata">

**Author:** ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)\
**Post date:** [May 28, 2019, 6:28pm UTC](https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653/3 "2019-05-28T18:28:00Z")

</div>

I am still looking for a solution, so thank you for responding @Kaiyan_Sheng. I will look into the discussion that you provided.

---

<div class="post-metadata">

**Author:** ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)\
**Post date:** [June 3, 2019, 4:17pm UTC](https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653/4 "2019-06-03T16:17:59Z")

</div>

Finally able to get it working.  
Followed the instructions given by this [post](https://discuss.elastic.co/t/metricbeat-not-reporting-on-port-10255-anymore-using-latest-kubernetes-how-to-use-the-secured-port-10250/153605/4)  
Where configured hosts as `https://${NODE_NAME}:10250`, then also I was getting “`x509: certificate signed by unknown authority`” error. As per this [post](https://discuss.elastic.co/t/kubernetes-module-kubelet-ssl/147770/10) disabled SSL verification for now, then able to get the Kubernetes metrics.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 1, 2019, 4:17pm UTC](https://discuss.elastic.co/t/metricbeat-in-kubernetes-404-error-for-kubernetes-module-events/181653/5 "2019-07-01T16:17:59Z")

</div>

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