# How to ensure Lifecycle Policy is applied when redeploying Metricbeat in Kubernetes?

**URL:** <https://discuss.elastic.co/t/how-to-ensure-lifecycle-policy-is-applied-when-redeploying-metricbeat-in-kubernetes/241106>\
**Category:** Beats\
**Tags:** ilm-index-lifecycle-management, metricbeat\
**Created:** [July 14, 2020, 9:53am UTC](https://discuss.elastic.co/t/how-to-ensure-lifecycle-policy-is-applied-when-redeploying-metricbeat-in-kubernetes/241106 "2020-07-14T09:53:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mattness](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattness/32/52975_2.png) [@Mattness](https://discuss.elastic.co/u/Mattness)\
**Post date:** [July 14, 2020, 9:53am UTC](https://discuss.elastic.co/t/how-to-ensure-lifecycle-policy-is-applied-when-redeploying-metricbeat-in-kubernetes/241106/1 "2020-07-14T09:53:54Z")

</div>

Hello,

I had a problem where my Metricbeat index would not update according to the Lifecycle Policy I had set in the config. As it turns out there was a default "metricbeat" Lifecycle Policy active which overrode my configuration. I was able to change the Policy via the Kibana UI but I was wondering if there was a more reliable way to ensure my policy will be used.

I know that you can define a Lifecycle Policy via the index template. Is there a way which would allow me to easily add this to my config automatically?

I am running Metricbeat via Kubernetes and want the policy to always stay active .. for instance if I redeploy Metricbeat I dont want to run the risk of it changing to another default policy.

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [July 15, 2020, 7:54am UTC](https://discuss.elastic.co/t/how-to-ensure-lifecycle-policy-is-applied-when-redeploying-metricbeat-in-kubernetes/241106/2 "2020-07-15T07:54:41Z")

</div>

Hi!

You can define your related [configuration](https://www.elastic.co/guide/en/beats/metricbeat/current/ilm.html) in Metricbeat's k8s manifests similarly to what we do in order to configure the output at [https://github.com/elastic/beats/blob/751a1d3eb31bf2cb35d39517e2f39c2b36a94a6c/deploy/kubernetes/metricbeat/metricbeat-deployment-configmap.yaml#L22](https://github.com/elastic/beats/blob/751a1d3eb31bf2cb35d39517e2f39c2b36a94a6c/deploy/kubernetes/metricbeat/metricbeat-deployment-configmap.yaml#L22).

C.

---

<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:** [August 12, 2020, 9:58am UTC](https://discuss.elastic.co/t/how-to-ensure-lifecycle-policy-is-applied-when-redeploying-metricbeat-in-kubernetes/241106/3 "2020-08-12T09:58:11Z")

</div>

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