What is the relationship between PersistentVolume and PersistentVolumeClaims

What is the relationship between the two? How can I indicate that PersistentVolumeClaim should use a specific PersistentVolume? this is apparently a file exchange between all PersistentVolumeClaims

+6
source share
2 answers

Yes, this sharing, as you stated, is true, and you could say that it is at least very worrying if you want certain volumes to be for a specific purpose. This is useful if you have random volumes used, which is often not the case.

Scenario: Create an NFS volume for 1 database and a second volume for the second database. The database should be kept between reboots of module / full system reboots and should be installed again without any problems.

To solve this scenario (within the limits of Coubernes), there are several possible solutions:

  • Use the namespace as a solution to prevent cross-use of volumes, which can cause problems with the namespace because containers must talk through an external (or flat) network to interact with each other when crossing namespaces.

  • Another possible solution to this scenario is to create mount points using the mounted OS and use the then local volume. This will work, but requires an OS template maintenance that we tried to prevent the use of Kubernetes.

  • The third possible solution is to mount NFS from your container, thus completely avoiding the approach to persistent volumes, see How to connect an external nfs resource in Kubernetes? for this

+1
source

You can think of PVC (constant volume requirement) as a storage request made by the module. The volume controller executes the query by finding the corresponding volume and binding two. Persistent volumes can be recycled, cleaned, etc., since they are released by the pod and reused by others. For a more detailed description, see https://github.com/kubernetes/kubernetes/blob/release-1.1/docs/user-guide/persistent-volumes.md#lifecycle-of-a-volume-and-claim .

0
source

All Articles