<p>I'm running a MySQL image in my one-node cluster for local testing purposes only.</p>
<p>I would like to be able to delete the database when needed to have the image build a new database from scratch, but I can't seem to find where or how I can do that easily.</p>
<p>I am on Windows, using Docker Desktop to manage my Docker images and Kubernetes cluster with WSL2. The pod uses a persistent volume/claim which can be seen below.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: mysql-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 3Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/var/MySQLTemp&quot;
    type: DirectoryOrCreate
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
</code></pre>
<p>The volume part of my deployment looks like:</p>
<pre class="lang-yaml prettyprint-override"><code>        volumeMounts:
        - name: mysql-persistent
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent
        persistentVolumeClaim:
          claimName: mysql-pv-claim
</code></pre>
<p>Is there a command I can use to either see where this database is stored on my Windows or WSL2 machine so I can delete it manually, or delete it from the command line through <code>docker</code> or <code>kubectl</code>?</p>

<p>For anyone looking in the future for this solution, and doesn't want to dredge through deep github discussions, my solution was this:</p>
<p>Change <code>hostPath:</code> to <code>local:</code> when defining the path. hostPath is apparently for if your kubernetes node providers have external persistent disks, like GCE or AWS.</p>
<p>Second, the path pointing to the symlink to your local machine from Docker desktop can apparently be found at <code>/run/desktop/mnt/host/c</code> for your c drive. I set my path to <code>/run/desktop/mnt/host/c/MySQLTemp</code> and created a <code>MySQLTemp</code> file in the root of my C drive, and it works.</p>
<p>Third, a <code>local:</code> path definition requires a nodeAffinity. You can tell it to use Docker Desktop like this:</p>
<pre class="lang-yaml prettyprint-override"><code>spec:
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
                - docker-desktop
</code></pre>
