<p>I have a deployment with specific mounts (please refer to pod dscription below).</p>

<p>But whenever I write into the specified directory in the container it isn't shown in the host folder. </p>

<p>For example:</p>

<pre><code>$ kubectl exec owncloud-68c956f65c-cpxp4 -- ls /var/www/html/data

admin
avatars
files_external
index.html
owncloud.db
owncloud.log

$ ls /disk1/owncloud
...nothing...
</code></pre>

<p>Here is the pod full description:</p>

<pre><code>Name:               owncloud-68c956f65c-cpxp4
Namespace:          default
Priority:           0
PriorityClassName:  &lt;none&gt;
Node:               k8s-worker-01/192.168.0.2
Start Time:         Mon, 27 May 2019 11:12:03 +0100
Labels:             app=owncloud
                    pod-template-hash=68c956f65c
Annotations:        &lt;none&gt;
Status:             Running
IP:                 10.40.0.4
Controlled By:      ReplicaSet/owncloud-68c956f65c
Containers:
  owncloud:
    Container ID:   docker://68d8d96833635927e0317b849a59539cd8f119231a3a41b3a7be4deb5914aa9c
    Image:          owncloud:latest
    Image ID:       docker-pullable://owncloud@sha256:173811cb4c40505401595a45c39a802b89fb476885b3f6e8fe327aae08d20fe8
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 27 May 2019 11:12:13 +0100
    Ready:          True
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-7b4bw (ro)
      /var/www/html/config from config (rw)
      /var/www/html/data from data (rw)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  config:
    Type:          HostPath (bare host directory volume)
    Path:          /home/pi/owncloud/owncloud_conf
    HostPathType:  Directory
  data:
    Type:          HostPath (bare host directory volume)
    Path:          /disk1/owncloud
    HostPathType:  Directory
  default-token-7b4bw:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-7b4bw
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          &lt;none&gt;
</code></pre>

<p>What's wrong here ?</p>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam</p>

Baptiste Arnaud
<p>Based on the message exchanged, the directory <code>/disk1/owncloud</code> resides on the <code>master node</code>, the pod described on your question shows that the type of volume used is <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">hostpath</a>, and it was scheduled for another node (<code>k8s-worker-01/192.168.0.2</code>) that does not have the hostpath informed. </p>

<p>To fix that you should consider move the mount point for a worker node (unless you want to run the pod on master) and use rules for <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature" rel="nofollow noreferrer">pod affinity</a> or <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector" rel="nofollow noreferrer">nodeSelector</a>.</p>

<p>If you want a resilient solution for storage (replicas, distribution among different nodes), I would recommend to use:</p>

<ul>
<li><a href="https://rook.io" rel="nofollow noreferrer">rook.io</a>: Really great, good docs and coverage different aspects of storage (block,file,object and for different backends ...) </li>
<li><a href="https://github.com/gluster/gluster-block" rel="nofollow noreferrer">gluster-block</a>: it is a plug-in for gluster storage, this is used combined with heketi. See docs <a href="https://github.com/gluster/gluster-kubernetes/blob/master/docs/design/gluster-block-provisioning.md" rel="nofollow noreferrer">k8s provisioning</a></li>
</ul>
