# Attempting to acquire leader lease ... Get "https://10.43.0.1:443/apis/coordination.k8s.io/v1/namespaces/bilalnamespace/leases/metricbeat-cluster-leader": Forbidden

**URL:** https://discuss.elastic.co/t/attempting-to-acquire-leader-lease-get-https-10-43-0-1-443-apis-coordination-k8s-io-v1-namespaces-bilalnamespace-leases-metricbeat-cluster-leader-forbidden/304012
**Category:** Beats
**Tags:** docker, metricbeat
**Created:** [May 5, 2022, 9:44am UTC](https://discuss.elastic.co/t/attempting-to-acquire-leader-lease-get-https-10-43-0-1-443-apis-coordination-k8s-io-v1-namespaces-bilalnamespace-leases-metricbeat-cluster-leader-forbidden/304012 "2022-05-05T09:44:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bilal\_El\_Mahdaoui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bilal_el_mahdaoui/32/97459_2.png) [@Bilal\_El\_Mahdaoui](https://discuss.elastic.co/u/Bilal_El_Mahdaoui)
#### Post date: [May 5, 2022, 9:44am UTC](https://discuss.elastic.co/t/attempting-to-acquire-leader-lease-get-https-10-43-0-1-443-apis-coordination-k8s-io-v1-namespaces-bilalnamespace-leases-metricbeat-cluster-leader-forbidden/304012/1 "2022-05-05T09:44:43Z")

</div>

Hello,

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 :

```auto
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.  
[metricbeat-kubernetes.yaml](https://raw.githubusercontent.com/elastic/beats/8.1/deploy/kubernetes/metricbeat-kubernetes.yaml)

---

<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: [June 2, 2022, 11:45am UTC](https://discuss.elastic.co/t/attempting-to-acquire-leader-lease-get-https-10-43-0-1-443-apis-coordination-k8s-io-v1-namespaces-bilalnamespace-leases-metricbeat-cluster-leader-forbidden/304012/2 "2022-06-02T11:45:27Z")

</div>

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