看不到已安装卷的变化

Can't see changes in Mounted volumes

我有一个带有特定挂载的部署(请参阅下面的 pod 描述)。

但是每当我写入容器中的指定目录时,它都不会显示在主机文件夹中。

例如:

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

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

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

这是广告连播的完整描述:

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>

这是怎么回事?

事实上,痛苦本身很重要,学生的教育将随之而来,但同时也会发生一些巨大的痛苦和磨难。因为我来得最少

根据交换的消息,目录 /disk1/owncloud 位于 master node,您问题中描述的 pod 显示使用的卷类型是 hostpath,并且它是安排给另一个没有通知主机路径的节点 (k8s-worker-01/192.168.0.2)。

要解决这个问题,您应该考虑移动工作节点的挂载点(除非您想 运行 主节点上的 pod)并使用 pod affinity or nodeSelector.

的规则

如果你想要一个有弹性的存储解决方案(副本,不同节点之间的分布),我建议使用:

  • rook.io:非常棒的好文档,涵盖了存储的不同方面(块、文件、对象和不同的后端......)
  • gluster-block: it is a plug-in for gluster storage, this is used combined with heketi. See docs k8s provisioning