# Filebeat on kubernetes: cant make it work without cluster roles

**URL:** <https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586>\
**Category:** Beats\
**Tags:** docker, filebeat\
**Created:** [November 30, 2021, 5:40pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586 "2021-11-30T17:40:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guillaume84](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Guillaume84](https://discuss.elastic.co/u/Guillaume84)\
**Post date:** [November 30, 2021, 5:40pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/1 "2021-11-30T17:40:05Z")

</div>

Hello,

I am trying to deploy a filebeat container (not daemonset) on a k8s cluster (kub 1.21)  
Used image: elastic/filebeat:7.8.1

Image starts correctly but i can't have the filebeat working correctly :

`E1130 15:47:41.183053 1 reflector.go:125] github.com/elastic/beats/libbeat/common/kubernetes/watcher.go:146: Failed to list *v1.Pod: pods is forbidden: User "system:serviceaccount:xxx:airflow-worker" cannot list resource "pods" in API group "" at the cluster scope`

Filebeat always asks for cluster roles (that i dont have cause its a mutualized cluster) and i cant avoid this error, even when trying to use a autodiscover specially on my ns :

```auto
  autodiscover:
    providers:
      - type: kubernetes
        namespace: xxx
        templates:
          - condition:
              equals:
                kubernetes.namespace: xxx

```

Is it impossible to use a filebeat container on K8S without cluster roles on the running Service account ????

Regards,  
Guillaume

---

<div class="post-metadata">

**Author:** ![legoguy1000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legoguy1000/32/54301_2.png) [@legoguy1000](https://discuss.elastic.co/u/legoguy1000)\
**Post date:** [December 1, 2021, 5:30am UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/2 "2021-12-01T05:30:58Z")

</div>

I don't think so since the bhave to give the pod/filebeat some sort of credentials that's can query the k8s API to pull the data.

---

<div class="post-metadata">

**Author:** ![Guillaume84](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Guillaume84](https://discuss.elastic.co/u/Guillaume84)\
**Post date:** [December 1, 2021, 9:29am UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/3 "2021-12-01T09:29:59Z")

</div>

is there any existing workaround ? cause this is death sentence of beats on every mutualized cluster where clients dont have clusterroles

---

<div class="post-metadata">

**Author:** ![legoguy1000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legoguy1000/32/54301_2.png) [@legoguy1000](https://discuss.elastic.co/u/legoguy1000)\
**Post date:** [December 1, 2021, 1:34pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/4 "2021-12-01T13:34:58Z")

</div>

No there is no way to interact with a secured k8s cluster without credentials. It's no different than if u try to use `kubectl`, u have to be authenticated and will only have the privs you've been given.

---

<div class="post-metadata">

**Author:** ![Guillaume84](https://avatars.discourse-cdn.com/v4/letter/g/4da419/32.png) [@Guillaume84](https://discuss.elastic.co/u/Guillaume84)\
**Post date:** [December 1, 2021, 1:37pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/5 "2021-12-01T13:37:22Z")

</div>

@legoguy1000 : i am authentified, my question is how to make filebeat sidecar work w/o cluster roles, which means only with namespace limited rights (roles & bindings roles, not clusterRole and clusterBindingRoles

---

<div class="post-metadata">

**Author:** ![legoguy1000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legoguy1000/32/54301_2.png) [@legoguy1000](https://discuss.elastic.co/u/legoguy1000)\
**Post date:** [December 1, 2021, 1:39pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/6 "2021-12-01T13:39:36Z")

</div>

That one I don't know. I've only ever messed with cluster roles.

---

<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:** [December 29, 2021, 3:40pm UTC](https://discuss.elastic.co/t/filebeat-on-kubernetes-cant-make-it-work-without-cluster-roles/290586/7 "2021-12-29T15:40:31Z")

</div>

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