# Deploying elastic agent container in kubernetes: error retrieving resource lock

**URL:** <https://discuss.elastic.co/t/deploying-elastic-agent-container-in-kubernetes-error-retrieving-resource-lock/326227>\
**Category:** Elastic Agent\
**Created:** [February 22, 2023, 9:22pm UTC](https://discuss.elastic.co/t/deploying-elastic-agent-container-in-kubernetes-error-retrieving-resource-lock/326227 "2023-02-22T21:22:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmyns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jmyns/32/116863_2.png) [@jmyns](https://discuss.elastic.co/u/jmyns)\
**Post date:** [February 22, 2023, 9:22pm UTC](https://discuss.elastic.co/t/deploying-elastic-agent-container-in-kubernetes-error-retrieving-resource-lock/326227/1 "2023-02-22T21:22:24Z")

</div>

When I deploy an elastic agent image I see this repeated error in the container logs.  
`error retrieving resource lock default/elastic-agent-cluster-leader: leases.coordination.k8s.io "elastic-agent-cluster-leader" is forbidden: User "system:serviceaccount:default:default" cannot get resource "leases" in API group "coordination.k8s.io" in the namespace "default"`

Agent enrollment is successful and I can manage the agent from our fleet cluster and I can still receive logs and metrics.

This agent is not intended to monitor our internal k8s infrastructure. Can these logs be ignored? Is there any way to disable these logs? What are the implications of deploying the agent in this manner.

Alternatively, I have deployed the agent with a ClusterRole, ClusterRoleBinding, and ServiceAccount and the error log is no longer present - so I'm curious what I am missing if I go with the first deployment method.

---

<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:** [March 22, 2023, 9:23pm UTC](https://discuss.elastic.co/t/deploying-elastic-agent-container-in-kubernetes-error-retrieving-resource-lock/326227/2 "2023-03-22T21:23:01Z")

</div>

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