I want to monitor my Kubernetes cluster using metricbeat, and I'm using for that metricbeat autodiscover feature . Also I use a custom docker image based on my custom debian bullseye image.
I made all the necessary configurations : Roles and ClusterRoles.
The problem is that the autodiscover didn't work and I get this error message :
E0504 14:41:40.623715 1 leaderelection.go:330] error retrieving resource lock bilalnamespace/metricbeat-cluster-leader: Get "https://10.43.0.1:443/apis/coordination.k8s.io/v1/namespaces/bilalnamespace/leases/metricbeat-cluster-leader": Forbidden
Also I tried the official docker image and it works fine.
I didn't understand what is the problem, do you have any ideas ?
to deploy on Kubernetes I used the official yaml file.