<p>I am trying to get mongo-replicaset chart working.</p>

<p>Kubelet report this error while mongo-replicaset chart deployment:</p>

<pre><code>MountVolume.SetUp failed for volume "mongo-two": lstat /mongo/data: no such file or directory
</code></pre>

<p>On each node, /mongo/data folder <strong>exist</strong>, driving me crazy. Note: on nodes, lstat command doesn't exists, but I suspect kubelet container to bring it.?
<a href="https://i.stack.imgur.com/4cSod.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4cSod.png" alt="enter image description here"></a></p>

<p>I have 3 persistent volumes:</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: mongo-[one/two/three]
spec:
  capacity:
    storage: 40Gi
  accessModes:
  - ReadWriteOnce
  storageClassName: local-storage
  local:
    path: /mongo/data
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - [one/two/three]
</code></pre>

<p>StatefulSet yaml: (mongo-replicaset helm chart 3.8.0)</p>

<pre><code>...
  volumeMounts:
    - mountPath: /data/db
      name: datadir
...
  volumeClaimTemplates:
  - metadata:
      creationTimestamp: null
      name: datadir
    spec:
      accessModes:
      - ReadWriteOnce
      storageClassName: local-storage
      resources:
        requests:
          storage: 40Gi
...
</code></pre>

<p>Still having "no such directory" on an existing directory..
What's incorrect? I can give additionnal data if needed.</p>

<p>Thanks you</p>

Slim
<p>The problem came from kubelet which is containerized (because of Rancher installation)</p>

<p>I add a volume definition into kubelet containers and it's OK.</p>

<p>For those interested by creating persistent local volume in a Rancher - Kubernetes installation, just add this to your cluster yaml in order to kubelet can mount your volume:</p>

<pre><code>services:
  kubelet:
    extra_binds:
       - /path_to_mount:/path_to_mount:rshared
</code></pre>

<p>don't forget the two dot rshared.</p>
