gpt4 book ai didi

kubernetes - 具有AccessMode的Kubernetes PVC:ReadWriteOnce

转载 作者:行者123 更新时间:2023-12-02 12:08:24 26 4
gpt4 key购买 nike

我们的方案:

我们使用ceph rbd存储一些机器学习训练数据集,其工作流程如下:

使用AccessMode:ReadWriteOnce创建一个ceph-rbd pvc pvc-tranining-data。
使用1个容器创建一个写入作业,以装入pvc-training-data并将训练数据写入pvc-training-data。
将训练数据写入pvc-training-data后,容器将退出,并且k8s将pvc-trainiing-data pvc卸载,写入工作完成。
创建一个具有n个容器的读取作业,其中n >= 1使用readOnly: true装载pvc-training-data来消耗训练数据。
顺便说一句:我们使用k8s 1.6.1

到目前为止,工作流程在我们的使用场景中效果很好,但是我对PVC AccessMode和带有AccessMode的ceph rbd有一些疑问:ReadWriteOnce。

  1. How to understand AccessModes: ReadOnlyMany, ReadWriteOnce, ReadWriteMany? I think the usage scope is ReadOnlyMany < ReadWriteOnce < ReadWriteMay, so if I apply a PVC with AccessMode: ReadWriteOnce, it is ok I use it as AccessMode: ReadOnlyMany PVC, am I right?

  2. ceph rbd is a block device, each container(on different host) mount the same ceph rbd device will have their own filesystem, so the only allowed AccessMode is ReadOnlyMany or ReadWriteOnce, should we impose restrictions on ReadWriteOnce usage in k8s code?

  1. If a ReadWriteOnce pvc is mounted by a Pod with readOnly:false then no more Pod can mount this device, until it is unmounted.
  2. If a ReadWriteOnce pvc is mounted by a Pod with readOnly:true, it only can be mounted to other Pod as long as they set readOnly: true.
  3. there's no restrictions on container with in the same Pod, as they share the same filesystem from host ${KUBELET_ROOT}/plugins/{xx}/

最佳答案

关于第一个问题:

  1. How to understand AccessModes: ReadOnlyMany, ReadWriteOnce, ReadWriteMany? I think the usage scope is ReadOnlyMany < ReadWriteOnce < ReadWriteMay, so if I apply a PVC with AccessMode: ReadWriteOnce, it is ok I use it as AccessMode: ReadOnlyMany PVC, am I right?


docs明确指出:
Important! A volume can only be mounted using one access mode at a
time, even if it supports many.

我不知道你的第二个问题。但是我认为考虑第一个答案可能是无效的吗?

关于kubernetes - 具有AccessMode的Kubernetes PVC:ReadWriteOnce,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44173653/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com