大网数据广告活动
服务器运维问答

Kubernetes, Docker and vm.max_map_count

· 52CE 我爱测

While attempting to run ElasticSearch on K8 I ran into an error that would kill the container: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] Fortunately this is pretty well documented…

问题原文

原帖链接 · Spencer Ruport · CC BY-SA 4.0

While attempting to run ElasticSearch on K8 I ran into an error that would kill the container:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Fortunately this is pretty well documented and I was able to figure out a configuration setting for the container that got it stable. This question isn't about that.

The question that arises for me is why does this happen on K8 versus Docker? I'm using the same image (The official ES image) in both cases so what are some of the reasons why the value would be different? Is there a way I could configure K8 or the machines I'm running it on so that this situation wouldn't arise?

社区高分解答

原帖链接 · webwurst · CC BY-SA 4.0

The setting for vm.max_map_count can be changed on the host level. Your can read the current value like this: sysctl vm.max_map_count. To change it run: sudo sysctl -w vm.max_map_count=262144. This will be reverted by the next boot. To set it permanently add vm.max_map_count=262144 to /etc/sysctl.conf.

Most Elasticsearch setups for Kubernetes use an Init Container to make sure this value is set like required. The drawback here is that it needs to in privileged mode: Elasticsearch Helm Chart

It is also possible to set sysctls in the securityContext of a Pod. But for now virtual memory settings are considered unsafe and need some more tweaking on your Kubernetes setup.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-03-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。