# Kubernetes deployed Elastic Agent is looped in beat restart

**URL:** <https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707>\
**Category:** Elastic Agent\
**Tags:** metricbeat\
**Created:** [January 10, 2024, 8:11am UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707 "2024-01-10T08:11:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alphayeeeet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alphayeeeet/32/126382_2.png) [@Alphayeeeet](https://discuss.elastic.co/u/Alphayeeeet)\
**Post date:** [January 10, 2024, 8:11am UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707/1 "2024-01-10T08:11:14Z")

</div>

Hello,

I tried to deploy Fleet-managed Elastic Agent with Kubernetes Integration into RedHat OpenShift. When deploying an agent policy update using Fleet, the beats are caught up in a restart loop:

Agent version: beats/elastic-agent:8.11.2

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/b/db13d159f49828fbeacb145a58b4ed228e3b5134.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/7/878ed6f043a9bc85115d667b5bc46418b9eb861e.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/d/2d4797cad1f1a5737ab3802382d9da69354319ad.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/a/baa60be48866de3c787c6d98b8d7e104545263d0.png)

After restarting the agent pods manually , the problem is solved.

This might be a bug in Elastic Agent.

I would appreciate any advice. Thank you.

---

<div class="post-metadata">

**Author:** ![Alphayeeeet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alphayeeeet/32/126382_2.png) [@Alphayeeeet](https://discuss.elastic.co/u/Alphayeeeet)\
**Post date:** [January 15, 2024, 7:50am UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707/2 "2024-01-15T07:50:03Z")

</div>

Reposted: [Kubernetes deployed Elastic Agent is looped in beat restart](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/351054)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 15, 2024, 5:15pm UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707/3 "2024-01-15T17:15:47Z")

</div>

Hi @Alphayeeeet

Welcome to the community.

This is often caused by an out-of-memory issue. You might want to bump up the resources for the agent.

Also, I am going to close the other Topic as this is a fine / close enough category.

---

<div class="post-metadata">

**Author:** ![Alphayeeeet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alphayeeeet/32/126382_2.png) [@Alphayeeeet](https://discuss.elastic.co/u/Alphayeeeet)\
**Post date:** [January 22, 2024, 12:39pm UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707/4 "2024-01-22T12:39:06Z")

</div>

Hi @stephenb

Thank you for the reply. After increasing the memory limits, the agent is running smoothly. Maybe this could be added in the troubleshooting documentation of Elastic Agent?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 23, 2024, 7:58am UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707/5 "2024-01-23T07:58:07Z")

</div>

Actually there is a open issue to make this much easier to identify.

> <https://github.com/elastic/elastic-agent/issues/3641>
>
> We need to make it easier to detect inadequate memory limits on Kubernetes, whic…h are extremely common. 
> 
> The agent should detect when its last status was OOM killed and report its status as degraded. Detecting that an agent has been OOMKilled from diagnostics along is not easy, it must be inferred from process restarts appearing the agent diagnostics with no other plausible explanations.
> 
> Today the primary way for us to detect this is to instruct users to run \`kubectl describe pod\` and look for the following:
> \`\`\`
> Last State: Terminated
> Reason: OOMKilled
> Exit Code: 137
> \`\`\`
> 
> We should automate this process and have the agent read the last state and reason for itself and report it in the agent status report.

---

<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:** [February 20, 2024, 7:58am UTC](https://discuss.elastic.co/t/kubernetes-deployed-elastic-agent-is-looped-in-beat-restart/350707/6 "2024-02-20T07:58:38Z")

</div>

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