<p>Right now I'm using this <a href="https://gist.github.com/thbkrkr/bc12a3457fd0f71c5a2106b11ce8801e" rel="nofollow noreferrer">shell script</a> to configure my pods on GKE so that they all have proper amount of virtual memory, I guess there is way better solution, which I'm trying to find.</p>
<p>Probably something like extraObjects thing? like elasticsearch recommends <a href="https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-virtual-memory.html#k8s-virtual-memory" rel="nofollow noreferrer">here</a>.</p>
<p>So, what is the best way to set up vm.max_map_count for my nodes?</p>

Danyil Poprotskyi
<p>The two common ways to do this:</p>
<ol>
<li><p>Using an initContainer in the Pod specs which require the setting.  This is what the ElasticSearch doc you reference shows.  Note that in this case the initContainer will need escalated privileges</p>
</li>
<li><p>You can create a DaemonSet which essentially executes the script you linked on all nodes on which you wish to run pods which require the setting (or you can just run it on all nodes).  See <a href="https://cloud.google.com/solutions/automatically-bootstrapping-gke-nodes-with-daemonsets" rel="nofollow noreferrer">bootstrapping GKE nodes with DaemonSets</a> for more info on how to do this.</p>
</li>
</ol>
