# Unable to apply memory lock to deploy elastic 8 on k8s

**URL:** <https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [June 1, 2023, 5:42am UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897 "2023-06-01T05:42:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsingh\_2023](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsingh_2023/32/118013_2.png) [@rsingh\_2023](https://discuss.elastic.co/u/rsingh_2023)\
**Post date:** [June 1, 2023, 5:42am UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897/1 "2023-06-01T05:42:07Z")

</div>

I am running into issues with deploying elastic version 8.7 on kubernetes (k8s)

I am using this docker image for elastic version 8.7

I have enabled bootstrap memory\_lock as "true" but I see these error logs in my elastic master statefulset

```auto
[1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: memory locking requested for elasticsearch process but memory is not locked

```

In the first part of the pod log I see

```auto
[WARN][o.e.b.JNANatives] [elasticsearch-master-2]These can be adjusted by modifying /etc/security/limits.conf, for example:
	# allow user 'elasticsearch' mlockall
	elasticsearch soft memlock unlimited
	elasticsearch hard memlock unlimited

```

I am trying to set the ulimit for memory lock via an init container (before elasticsearch master container starts up)

```auto
   initContainers:
      - command:
        - sh
        - -c
        - ulimit -l unlimited

```

But still elasticsearch master is running into this on kubernetes (k8s) issue - it cannot recognize the memory lock

Has anyone encountered this problem and resolved it?

---

<div class="post-metadata">

**Author:** ![rsingh\_2023](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsingh_2023/32/118013_2.png) [@rsingh\_2023](https://discuss.elastic.co/u/rsingh_2023)\
**Post date:** [June 5, 2023, 5:59am UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897/2 "2023-06-05T05:59:14Z")

</div>

Can anyone assist on this?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 5, 2023, 7:17am UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897/3 "2023-06-05T07:17:24Z")

</div>

Welcome to our community! 😃

Are you using ECK?

---

<div class="post-metadata">

**Author:** ![rsingh\_2023](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsingh_2023/32/118013_2.png) [@rsingh\_2023](https://discuss.elastic.co/u/rsingh_2023)\
**Post date:** [June 5, 2023, 5:17pm UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897/5 "2023-06-05T17:17:57Z")

</div>

thanks Mark!

I am not using the operator - I am using the elastic helm chart but I cannot figure out how to set the proper ulimits to allow memory locking

Tried init containers and other solutions

---

<div class="post-metadata">

**Author:** ![rsingh\_2023](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsingh_2023/32/118013_2.png) [@rsingh\_2023](https://discuss.elastic.co/u/rsingh_2023)\
**Post date:** [June 5, 2023, 8:08pm UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897/6 "2023-06-05T20:08:51Z")

</div>

Is there to enable memory lock for kubernetes elastic pods running as non-root?

---

<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:** [July 3, 2023, 8:09pm UTC](https://discuss.elastic.co/t/unable-to-apply-memory-lock-to-deploy-elastic-8-on-k8s/334897/7 "2023-07-03T20:09:43Z")

</div>

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