这两者之间究竟有什么联系?我如何指定PersistentVolumeClaim必须使用特定的PersistentVolume?它似乎是在所有PersistentVolumeClaims
之间共享文件答案 0 :(得分:1)
Yes, this sharing as you stated it, is the case and you could say that this is at least very troubling if you want specific volumes for a given purpose. It is beneficial if you have random usable volumes, which is often not the case.
Scenario: Create a NFS volume for 1 database & a second volume for a second database. The database have to be retained between restarts of the pods/complete system reboots and have to be mounted again without issues later on.
To solve this scenario (within the constraints of Kubernetes) there are several possible solution paths:
Use the namespace as a solution to be able to prevent cross use of the volumes, resulting then in namespace issues since containers have to talk over the external (or flat) network to communicate with each other when crossing namespaces.
Another possible solution to solve this scenario is create the mount points using OS mounts and using the then present local volume. This will work, but requires maintenance of the OS template, something which we were trying to prevent using Kubernetes.
A third possible solutions is to have the NFS mount executed from within your container, thus avoiding the persistent volume approach completely, see How do you mount an external nfs share in Kubernetes? for this
答案 1 :(得分:0)
您可以将PVC(持久性卷声明)视为由pod进行存储的请求。卷控制器通过查找匹配的卷并绑定两者来满足请求。持久卷可以被回收,擦洗等,因为它们被一个pod释放并被另一个重用。有关更详细的说明,请参阅https://github.com/kubernetes/kubernetes/blob/release-1.1/docs/user-guide/persistent-volumes.md#lifecycle-of-a-volume-and-claim。