Can't see changes in Mounted volumes

5/27/2019

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

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

For example:

$ kubectl exec owncloud-68c956f65c-cpxp4 -- ls /var/www/html/data

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

$ ls /disk1/owncloud
...nothing...

Here is the pod full description:

Name:               owncloud-68c956f65c-cpxp4
Namespace:          default
Priority:           0
PriorityClassName:  <none>
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:        <none>
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:    <none>
    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:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>

What's wrong here ?

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

-- Baptiste Arnaud
kubernetes
persistent-volumes

1 Answer

6/6/2019

Based on the message exchanged, the directory /disk1/owncloud resides on the master node, the pod described on your question shows that the type of volume used is hostpath, and it was scheduled for another node (k8s-worker-01/192.168.0.2) that does not have the hostpath informed.

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 pod affinity or nodeSelector.

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

  • rook.io: Really great, good docs and coverage different aspects of storage (block,file,object and for different backends ...)
  • gluster-block: it is a plug-in for gluster storage, this is used combined with heketi. See docs k8s provisioning
-- gonzalesraul
Source: StackOverflow