Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/recipes/autopilot/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
securityContext:
privileged: true
runAsUser: 0
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 262144 > /proc/sys/vm/max_map_count']
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 1048576 > /proc/sys/vm/max_map_count']
Comment thread
shainaraskas marked this conversation as resolved.
Outdated
containers:
- name: sleep
image: docker.io/bash:5.2.15
Expand Down Expand Up @@ -60,7 +60,7 @@ spec:
cpu: 500m
initContainers:
- name: max-map-count-check
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"]
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 1048576 ]; then exit 0; fi; sleep 1; done"]
Comment thread
shainaraskas marked this conversation as resolved.
Outdated
resources:
requests:
memory: 16Mi
Expand Down
4 changes: 2 additions & 2 deletions config/recipes/autopilot/fleet-kubernetes-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
securityContext:
privileged: true
runAsUser: 0
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 262144 > /proc/sys/vm/max_map_count']
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 1048576 > /proc/sys/vm/max_map_count']
Comment thread
shainaraskas marked this conversation as resolved.
Outdated
containers:
- name: sleep
image: docker.io/bash:5.2.15
Expand Down Expand Up @@ -60,7 +60,7 @@ spec:
cpu: 500m
initContainers:
- name: max-map-count-check
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"]
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 1048576 ]; then exit 0; fi; sleep 1; done"]
Comment thread
shainaraskas marked this conversation as resolved.
Outdated
resources:
requests:
memory: 16Mi
Expand Down
2 changes: 1 addition & 1 deletion config/samples/elasticsearch/elasticsearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
# securityContext:
# privileged: true
# runAsUser: 0
# command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
# command: ['sh', '-c', 'sysctl -w vm.max_map_count=1048576']
###
# uncomment the line below if you are using a service mesh such as linkerd2 that uses service account tokens for pod identification.
# automountServiceAccountToken: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nodeSets:
config:
node.roles: ["master"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -54,7 +54,7 @@ nodeSets:
config:
node.roles: ["data_hot", "data_content", "ingest"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -103,7 +103,7 @@ nodeSets:
config:
node.roles: ["data_warm"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -152,7 +152,7 @@ nodeSets:
config:
node.roles: ["data_cold"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nodeSets:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ nodeSets:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nodeSets:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
Comment thread
shainaraskas marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ nodeSets:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
4 changes: 2 additions & 2 deletions deploy/eck-stack/charts/eck-elasticsearch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ nodeSets:
count: 1
config:
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -260,7 +260,7 @@ nodeSets:
# - command:
# - sh
# - "-c"
# - sysctl -w vm.max_map_count=262144
# - sysctl -w vm.max_map_count=1048576
# name: sysctl
# securityContext:
# privileged: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ nodeSets:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/agent/fleet-agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/apm-server/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/beats/metricbeat_hosts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ eck-elasticsearch:
count: 3
config:
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/custom-elasticsearch-kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ eck-elasticsearch:
count: 1
config:
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down
8 changes: 4 additions & 4 deletions deploy/eck-stack/examples/elasticsearch/hot-warm-cold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ eck-elasticsearch:
config:
node.roles: ["master"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -55,7 +55,7 @@ eck-elasticsearch:
config:
node.roles: ["data_hot", "data_content", "ingest"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -104,7 +104,7 @@ eck-elasticsearch:
config:
node.roles: ["data_warm"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down Expand Up @@ -153,7 +153,7 @@ eck-elasticsearch:
config:
node.roles: ["data_cold"]
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down
Comment thread
shainaraskas marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/enterprise-search/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/kibana/ingress/kibana-gke.yaml
Comment thread
shainaraskas marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ eck-elasticsearch:
- name: default
count: 3
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion deploy/eck-stack/examples/logstash/basic-eck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ eck-elasticsearch:
count: 3
config:
# Comment out when setting the vm.max_map_count via initContainer, as these are mutually exclusive.
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 262144
# For production workloads, it is strongly recommended to increase the kernel setting vm.max_map_count to 1048576
# and leave node.store.allow_mmap unset.
# ref: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html
#
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-topics/gke-autopilot.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
# Do not use this if setting config.node.store.allow_mmap: false
initContainers:
- name: max-map-count-check
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"]
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 1048576 ]; then exit 0; fi; sleep 1; done"]
EOF
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ endif::[]
= Virtual memory

By default, Elasticsearch uses memory mapping (`mmap`) to efficiently access indices.
Usually, default values for virtual address space on Linux distributions are too low for Elasticsearch to work properly, which may result in out-of-memory exceptions. This is why link:k8s-quickstart.html[the quickstart example] disables `mmap` through the `node.store.allow_mmap: false` setting. For production workloads, it is strongly recommended to increase the kernel setting `vm.max_map_count` to `262144` and leave `node.store.allow_mmap` unset.
Default values for virtual address space on Linux distributions can be too low for Elasticsearch to work properly, which may result in out-of-memory exceptions. This is why link:k8s-quickstart.html[the quickstart example] disables `mmap` through the `node.store.allow_mmap: false` setting. For production workloads, we recommend that you increase the kernel setting `vm.max_map_count` to `1048576` and leave `node.store.allow_mmap` unset.

The kernel setting `vm.max_map_count=262144` can be set on the host directly, by a dedicated init container which must be privileged, or a dedicated Daemonset.
The kernel setting `vm.max_map_count=1048576` can be set on the host directly, by a dedicated init container which must be privileged, or a dedicated Daemonset.

IMPORTANT: For {{es}} version 8.16 and later, set the `vm.max_map_count` kernel setting to `1048576`; for {{es}} version 8.15 and earlier, set `vm.max_map_count` to `262144`.

For more information, check the Elasticsearch documentation on
link:https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html[Virtual memory].
Expand Down Expand Up @@ -51,7 +53,7 @@ spec:
securityContext:
privileged: true
runAsUser: 0
command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
command: ['sh', '-c', 'sysctl -w vm.max_map_count=1048576']
EOF
----

Expand Down Expand Up @@ -89,7 +91,7 @@ spec:
securityContext:
privileged: true
runAsUser: 0
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 262144 > /proc/sys/vm/max_map_count']
command: ['/usr/local/bin/bash', '-e', '-c', 'echo 1048576 > /proc/sys/vm/max_map_count']
Comment thread
shainaraskas marked this conversation as resolved.
Outdated
containers:
- name: sleep
image: docker.io/bash:5.2.21
Expand Down Expand Up @@ -121,6 +123,6 @@ spec:
# Do not use this if setting config.node.store.allow_mmap: false
initContainers:
- name: max-map-count-check
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 262144 ]; then exit 0; fi; sleep 1; done"]
command: ['sh', '-c', "while true; do mmc=$(cat /proc/sys/vm/max_map_count); if [ ${mmc} -eq 1048576 ]; then exit 0; fi; sleep 1; done"]
EOF
----