<p>I scaled my statefulset up to 4, and when scaling down to 1, I saw that I still have 4 persistent volumes with indexes from 0 to 3.</p>
<p>I also saw that the status of all of them is <em>Bound</em>
I guess it is because I use it as stateful set, so it doesn't delete the volumes after scale down.</p>
<p>I tried to manually delete one of tham (the one with index 2) because I was sure it will release my volume, so I used:</p>
<pre><code>kubectl delete persistentvolume &lt;volume&gt;
</code></pre>
<p>Well, that didn't help, it just made this volume to be in a terminating state forever... :/</p>
<p>I have no idea how to remove this and all the other unused volumes now.</p>
<p>here is the volume configuration in stateful set yaml.</p>
<pre><code>  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes: [&quot;ReadWriteOnce&quot;]
        storageClassName: &quot;default&quot;
        resources:
          requests:
            storage: 7Gi
</code></pre>
<p>if I run</p>
<pre><code>kubectl get pvc --all-namespaces
</code></pre>
<p>I get</p>
<pre><code>NAMESPACE    NAME                      STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
default      data-0         Bound    pvc-23af1aec-e385-4778-b0b0-56f1d1dfdfee   7Gi        RWO            default        4h5m
default      data-1         Bound    pvc-34625107-1352-4715-b12c-2fc6ff22ed08   7Gi        RWO            default        4h4m
default      data-2         Bound    pvc-15dbdb53-d951-465d-b9c3-ebadfcc3c725   7Gi        RWO            default        4h3m
default      data-3         Bound    pvc-d317657f-194a-4f4f-8c5f-dff2843b693f   7Gi        RWO            default        4h3m
</code></pre>
<p>if I run</p>
<pre><code>kubectl get --no-headers persistentvolumes
</code></pre>
<p>I get this:</p>
<pre><code>pvc-15dbdb53-d951-465d-b9c3-ebadfcc3c725   7Gi   RWO   Delete   Terminating   default/data-2            default         4h4m
pvc-23af1aec-e385-4778-b0b0-56f1d1dfdfee   7Gi   RWO   Delete   Bound         default/data-0            default         4h6m
pvc-34625107-1352-4715-b12c-2fc6ff22ed08   7Gi   RWO   Delete   Bound         default/data-1            default         4h5m
pvc-d317657f-194a-4f4f-8c5f-dff2843b693f   7Gi   RWO   Delete   Bound         default/data-3            default         4h3m
</code></pre>

toto
<p>In statefulset, K8s doesn't delete <code>PV</code> or <code>PVC</code> by their own after termination of a pod automatically, It is to avoid further complication and for data safety. Thats why after doing scale down, we need to do it manually.Deleting the <code>PVC</code> after the pods have terminated will trigger deletion of the respective Persistent Volumes depending on the storage class and reclaim policy.</p>
<p>Please try to delete <code>persistent volume claim</code> or <code>PVC</code> instead of <code>persistent volume</code>. if you delete <code>pvc</code> it will automatically delete the respective <code>pv</code>.</p>
<p>just run this command in your bash:</p>
<p><code>kubectl delete pvc data-3</code></p>
<p><a href="https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/#persistent-volumes" rel="noreferrer">REF</a></p>
