Is it possible to have PVC's with the same name accross different namespace when using different PV's in Kubernetes? Is it possible to have PVC's with the same name accross different namespace when using different PV's in Kubernetes? kubernetes kubernetes

Is it possible to have PVC's with the same name accross different namespace when using different PV's in Kubernetes?


PVC is a namespaced resource but not PV. ie., you can have multiple PVC's with same name across difference namespaces.

There might be issues in the way you have configured the pv.

Can you make sure you are using the right ip address in pv configuration just under nfs attribute:

nfs:path: /nfs_server/prod01/dbserver: 158.87.52.35


Found the cause of my problem in the following link from OpenShift docs:

Turns out the problem was related to the wrong use of claimRefs in the yaml file used to create the prod-02 pv's, here's the full explanation:

Specifying a volumeName in your PVC does not prevent a different PVC from binding to the specified PV before yours does. Your claim will remain Pending until the PV is Available.

Specifying a claimRef in a PV does not prevent the specified PVC from being bound to a different PV. The PVC is free to choose another PV to bind to according to the normal binding process. Therefore, to avoid these scenarios and ensure your claim gets bound to the volume you want, you must ensure that both volumeName and claimRef are specified.

So right after fixing the claimRefs and recreating my pv's, the pvc started to get bonded as expected even with the same name used on other namespaces :-)