<p>I am deploying Elasticsearch 7.10.1 to AWS EKS Fargate but I got below error when running them:</p>
<pre><code>ERROR: [2] bootstrap checks failed
[1]: max number of threads [1024] for user [elasticsearch] is too low, increase to at least [4096]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
</code></pre>
<p>I found solutions for them is <a href="https://stackoverflow.com/questions/40683285/max-file-descriptors-4096-for-elasticsearch-process-is-too-low-increase-to-at">max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]</a> and <a href="https://stackoverflow.com/questions/51445846/elasticsearch-max-virtual-memory-areas-vm-max-map-count-65530-is-too-low-inc">Elasticsearch: Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]</a>.</p>
<p>But both requires a change on the host machine. I am using EKS Fargate which means I don't have access to the Kubernete cluster host machine. What else should I do to solve this issue?</p>

<p>Your best bet is to set these via privileged init containers within your Elasticsearch pod/deployment/statefulset, for example:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: elasticsearch-node
spec:
  initContainers:
    - name: increase-vm-max-map
      image: busybox
      command: [&quot;sysctl&quot;, &quot;-w&quot;, &quot;vm.max_map_count=262144&quot;]
      securityContext:
        privileged: true
    - name: increase-fd-ulimit
      image: busybox
      command: [&quot;sh&quot;, &quot;-c&quot;, &quot;ulimit -n 65536&quot;]
      securityContext:
        privileged: true
  containers:
    - name: elasticsearch-node
      ...
</code></pre>
<p>You could also do this through Daemonsets, although Daemonsets aren't very well suited to one-time tasks (but it's possible to hack around this).
But the init container approach will guarantee that your expected settings are in effect precisely before an Elasticsearch container is launched.</p>
