简体   繁体   中英

Elasticsearch kubernetes memory lock

I am running an Elastic cluster on Kubernetes, according to the Elastic documentation, memory lock needs to be set to true in order to disable swapping and increase performance.

How ever, when setting this value to true, my pod fails to start up with the following error:

This can result in part of the JVM being swapped out.
Increase RLIMIT_MEMLOCK, soft limit: 83968000, hard limit: 83968000
These can be adjusted by modifying /etc/security/limits.conf, for example:
# allow user 'elasticsearch' mlockall
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited

How would I change these settings if my elastic image is deployed to Kubernetes?

This can be solved by the use of custom entry point to the image.

You will first need to create a custom elastic image based off the official elastic image,

The custom entry point will then change the memory limits, looking something like this:

#!/bin/bash

# Set memlock limit
ulimit -u unlimited

# Call original entrypoint script
exec /docker-entrypoint.sh "${@}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM