<p>Basically, I have a problem deleting my <code>spoc-volume-spoc-ihm-kube-test</code> PVC I tried with:</p>
<pre><code>kubectl delete -f file.yml
kubectl delete PVC
</code></pre>
<p>but I get every time the same Terminating Status. Also, when I delete the PVC the console is stuck in the deleting process.</p>
<p>Capacity: 10Gi
Storage Class: rook-cephfs
Access Modes: RWX</p>
<p>Here is the status in my terminal:</p>
<blockquote>
<p>kubectl  get pvc
NAME                                    STATUS        VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS      AGE
spoc-volume-spoc-ihm-kube-test          Terminating   pvc-<em>-</em>  10Gi       RWX            rook-cephfs       3d19h</p>
</blockquote>
<p>Thank You for your answers,
Stack Community :)</p>

<p>You need to first check if the volume is attached to a resource using <code>kubectl get volume attachment</code>. If your volume is in the list, it means you have a resource i.e a pod or deployment that is attached to that volume. The reason why its not terminating is because the PVC and PV metadata <code>finalizers</code> are set to <code>kubernetes.io/pv-protection</code>.</p>
<h3>Solution 1:</h3>
<p>Delete the resources that are attached/using the volume i.e pods, deployments or statefulsets etc. After you delete the stuck PV and PVC will terminate.</p>
<h3>Solution 2</h3>
<p>If you are not sure where the volume is attached, you can delete/patch the PV and PVC metadata <code>finalizers</code> to null as follows:</p>
<p>a) Edit the PV and PVC and delete or set to null the <code>finalizers</code> in the metadata</p>
<pre><code>kubectl edit pv {PV_NAME}
kubectl edit pvc {PVC_NAME}
</code></pre>
<p>b) Simply patch the PV and PVC as shown below:</p>
<pre><code>kubectl patch pvc {PV_NAME} -p '{&quot;metadata&quot;:{&quot;finalizers&quot;:null}}'
kubectl patch pvc {PVC_NAME} -p '{&quot;metadata&quot;:{&quot;finalizers&quot;:null}}'
</code></pre>
<p>Hope it helps.</p>
