# Elastic-agent not recognizing provider section correctly

**URL:** <https://discuss.elastic.co/t/elastic-agent-not-recognizing-provider-section-correctly/311652>\
**Category:** Elastic Agent\
**Created:** [August 8, 2022, 2:43pm UTC](https://discuss.elastic.co/t/elastic-agent-not-recognizing-provider-section-correctly/311652 "2022-08-08T14:43:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lineconnect](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lineconnect](https://discuss.elastic.co/u/lineconnect)\
**Post date:** [August 8, 2022, 2:43pm UTC](https://discuss.elastic.co/t/elastic-agent-not-recognizing-provider-section-correctly/311652/1 "2022-08-08T14:43:48Z")

</div>

Hi there,

banging my head against a wall for a few ours now...  
Using elastic-agent 7.16.2(docker image) in k8s and i want to disable certain providers as well as the leader election.

But the agent will always try to read the leader status.

Config status:

```auto
bash-4.2$ elastic-agent -c /etc/elastic-agent.yml inspect
agent:
  logging:
    level: debug
  monitoring:
    enabled: false
    logs: false
    metrics: false
  reload:
    enabled: false
outputs:
  default:
    hosts:
    - elasticsearch.efk:9200
    password: REMOVED
    type: elasticsearch
    username: logagent-radius-felix
path:
  config: /usr/share/elastic-agent
  data: /usr/share/elastic-agent/data
  home: /usr/share/elastic-agent/data/elastic-agent-3c518f
  logs: /usr/share/elastic-agent
providers:
  agent:
    enabled: false
  docker:
    enabled: false
  host:
    enabled: false
  kubernetes:
    enabled: false
  kubernetes_leaderelection:
    enabled: false
runtime:
  arch: amd64
  os: linux
  osinfo:
    family: redhat
    major: 7
    minor: 9
    patch: 2009
    type: linux
    version: 7 (Core)

```

Starting the agent:

```auto
bash-4.2$ elastic-agent -c /etc/elastic-agent.yml        
I0808 14:40:16.686029 105 leaderelection.go:243] attempting to acquire leader lease cust-felix/elastic-agent-cluster-leader...
E0808 14:40:16.698908 105 leaderelection.go:325] error retrieving resource lock cust-felix/elastic-agent-cluster-leader: leases.coordination.k8s.io "elastic-agent-cluster-leader" is forbidden: User "system:serviceaccount:cust-felix:default" cannot get resource "leases" in API group "coordination.k8s.io" in the namespace "cust-felix"

```

elastic-agent.yml:

```auto
bash-4.2$ cat /etc/elastic-agent.yml 
outputs:
  default:
    type: elasticsearch
    hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
    username: '${ELASTICSEARCH_USERNAME}'
    password: '${ELASTICSEARCH_PASSWORD}'

providers:
  host:
    enabled: false
  agent: 
    enabled: false
  docker:
    enabled: false
  kubernetes:
    enabled: false
  kubernetes_leaderelection:
    enabled: false

agent:
  monitoring:
    enabled: false
    logs: false
    metrics: false
  reload: 
    enabled: false
  logging:
    level: debug

```

I've also tried to adjust the leader name but it will not be read...  
With version 8.3.3 it's working but we have to go with 7.16.2 for now

---

<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:** [September 5, 2022, 2:43pm UTC](https://discuss.elastic.co/t/elastic-agent-not-recognizing-provider-section-correctly/311652/2 "2022-09-05T14:43:57Z")

</div>

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