<p>It is a common issue still seems unresolved:</p>

<pre><code>ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];
Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
</code></pre>

<p>I am trying to run it on a cluster setup by RKE. I started to use it in an outofabox manner, means only using it as a dependency :</p>

<pre><code>dependencies:
  - name: elasticsearch
    version: 7.6.2
    repository: https://helm.elastic.co
</code></pre>

<p>It just fails right away.</p>

<p>I am aware and have followed the corresponding github issues like: <br>
<a href="https://github.com/elastic/helm-charts/issues/429" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/issues/429</a> <br>
<a href="https://github.com/elastic/helm-charts/issues/137" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/issues/137</a> <br>
<a href="https://github.com/elastic/helm-charts/issues/388" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/issues/388</a> <br>
<a href="https://github.com/elastic/helm-charts/issues/258" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/issues/258</a> <br></p>

<p>I have also tried to cmod-ing it by hand in 'initresources' , I have played with fsgroup, and I have also tried to use Rancher Local Path Provisioner(menioned in issue 429). <br>
No success at all ,same exception comes every time.</p>

<p>Any idea?</p>

<p>Pasting here the answer I gave at <a href="https://github.com/elastic/helm-charts/issues/258" rel="nofollow noreferrer">https://github.com/elastic/helm-charts/issues/258</a></p>
<p>Basically, I've fixed this issue by grabbing the values.yaml from the helm chart and adding a securityContext. The configure-sysctl initContainer that comes with the chart itself does this (privileged + runAsUser):</p>
<pre><code>extraInitContainers:
   - name: file-permissions
     image: busybox
     command: ['chown', '-R', '1000:1000', '/usr/share/elasticsearch/']
     volumeMounts:
     - mountPath: /usr/share/elasticsearch/data
       name: elasticsearch-master
     securityContext:
       privileged: true
       runAsUser: 0
</code></pre>
