Kubernetes NFS Persistent Volumes - multiple claims on same volume? Claim stuck in pending?

后端 未结 4 1807
遥遥无期
遥遥无期 2020-12-17 08:51

Use case:

I have a NFS directory available and I want to use it to persist data for multiple deployments & pods.

I have created a PersistentVolume<

4条回答
  •  無奈伤痛
    2020-12-17 09:28

    A persistent volume claim is exclusively bound to a persistent volume.
    You cannot bind 2 pvc to the same pv.

    I guess you are interested in the dynamic provisioning. I faced this issue when I was deploying statefulsets, which require dynamic provisioning for pods. So you need to deploy an NFS provisioner in your cluster, the NFS provisioner(pod) will have access to the NFS folder(hostpath), and each time a pod requests a volume, the NFS provisioner will mount it in the NFS directory on behalf of the pod.
    Here is the github repository to deploy it:
    https://github.com/kubernetes-incubator/external-storage/tree/master/nfs/deploy/kubernetes
    You have to be careful though, you must ensure the nfs provisioner always runs on the same machine where you have the NFS folder by making use of the node selector since you the volume is of type hostpath.

提交回复
热议问题