<p>This question arose when we ran a <code>kubectl delete -f</code> on a file that somehow contained the declaration of the namespace where an entire test deployment existed.</p>
<p>The system (not configured by us, hence a bit obscure to us) had volumes provisioned by an OpenEBS system.</p>
<p>Within the deleted namespace there were some PVCs that had PVs provisioned on OpenEBS. When the namespace was deleted PVCs were deleted and all the PVs too.</p>
<p>I read quite some documentation, but I have not found an explicit answer to my question. Knowing that;</p>
<ul>
<li>PVs are not scoped so do not belong to any namespace</li>
<li>If a PVC is deleted the bound (if present) PV is deleted only if the <code>reclaimPolicy</code> is set to <code>Delete</code></li>
</ul>
<p>The only case when PVs are deleted as a consequence of a namespace deletion is if the namespace contains a PVC bound to a PV with a <code>reclaimPolicy: Delete</code>. Hence all the provisioned PVs in our system had this issue. Or m I missing something?</p>

<p>Basically the flow is like:</p>
<ul>
<li>when a namespace is deleted, all the objects inside this namespace is also will be deleted</li>
<li>Now, if there is any PVC in that deleted namespace then it will be deleted</li>
<li>According to the rules, If a PVC is deleted then it's bounded PV will also be deleted if the <code>reclaimPolicy</code> is delete.</li>
</ul>
<p>N.B: Normally to delete a PVC first you need to delete the pods those are referencing it. And to delete a bound PV first you need to delete it's respective PVC. Deletion system is like : first pods (who are referencing that PVC) get deleted then the respective PVC and then the PV(if reclainPolicy is delete).</p>
