<p>I created a PV and a PVC on docker-desktop and even after removing the pv and pvc the file still remains. When I re-create it, it attaches the same mysql database to new pods. How do you manually delete the files created by the hostPath? I suppose one way is to just reset Kubernetes in the preferences but there has to be another less nuclear option. </p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: mysql-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 20Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Delete
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pv-claim2
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
</code></pre>

joshduffney
<p>According to the <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#recycle" rel="noreferrer">docs</a>, "...<code>Recycle</code> reclaim policy performs a basic scrub (<code>rm -rf /thevolume/*</code>) on the volume and makes it available again for a new claim". <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaim-policy" rel="noreferrer">Also</a>, "...Currently, only NFS and HostPath support recycling". So, try changing</p>

<pre><code>persistentVolumeReclaimPolicy: Delete
</code></pre>

<p>to</p>

<pre><code>persistentVolumeReclaimPolicy: Recycle
</code></pre>
