<p>I'm learning Kubernetes and trying to follow the following tutorial to create a Mysql database:</p>
<p><a href="https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/#:%7E:text=Deploy%20MySQL,MySQL%20and%20references%20the%20PersistentVolumeClaim" rel="noreferrer">https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/#:~:text=Deploy%20MySQL,MySQL%20and%20references%20the%20PersistentVolumeClaim</a>.</p>
<p>Until now, I've been using Docker and Docker-compose to do all of my development and production work.</p>
<p>Using Docker Desktop's (On Mac) Kubernetes single master node cluster, I was able to get the example working and interact with Mysql creating a table and filling some data. After deleting the resources and retrying, the data persisted and I was able to access the data immediately upon reinstalling the Deployment, service, PV and PVC. A successful pre-requisite for connecting an application.</p>
<p>However I cannot for the life of me find out WHERE the data is actually being stored on my laptop's local file system . There are only 2 file paths listed in these examples. One in the deployment (which I assume to be the container's internal filesystem , Similar to Docker's container internal path):</p>
<pre><code>volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql 
</code></pre>
<p>And the persistent volume path (Which I assume to be docker's Host system equivalent file path):</p>
<pre><code>hostPath:
    path: &quot;/mnt/data&quot; 
</code></pre>
<p>My problem is : Nowhere on my laptop can I find either of these paths. /mnt/data does not exist from my laptop's root directly (where I would have expected it to be) , despite the PV still being active, and I see nowhere where the kubernetes cluster, node, or pod is mounted on my file system. WHERE on my laptop is this data being stored?? This isn't necessarily a practically useful thing to know, but it's critical to know in order to have a good grasp of understanding kubernetes and how it works, and I'm unwilling and unable to continue learning kubernetes until I can figure out where physically the data is stored on the host filesystem.</p>
<p>I've seen another question saying to &quot;SSH into the Node that's running the PV Resource&quot; , But I feel like that's referencing a distributed cloud system where the node exists on a separate server, and as stated I cannot find the mount path to my one master node running locally. Everything else seems to point to the not-useful official docs on PV and PVCs.</p>
<p>Can anyone explain to me where this mysql data should be?</p>

Tyler Stone
<p>Docker Desktop on a Mac runs <a href="https://docs.docker.com/docker-for-mac/docker-toolbox/#the-docker-desktop-on-mac-environment" rel="noreferrer">a virtual machine to run docker inside</a>. You're correct when you look at the <code>hostPath.path</code> - that's where it's stored. But because docker/Kubernetes is inside the VM, that's where the path is relative to.</p>
<p>To see this yourself is a little tricky, Docker Desktop doesn't provide a guide on getting inside the VM. The community has <a href="https://gist.github.com/BretFisher/5e1a0c7bcca4c735e716abf62afad389" rel="noreferrer">some options though</a>. An easy way would be <code>docker run -it --rm --privileged --pid=host justincormack/nsenter1</code>. That command runs a container inside docker that gets you a shell on the VM containing the docker daemon.</p>
<p>As to where this is on your laptop, you can follow the <a href="https://docs.docker.com/docker-for-mac/space/" rel="noreferrer">docs about the disk image for the VM</a>. <strong>Preferences &gt; Resources &gt; Advanced</strong> will show you where the disk image file is physically located on your laptop.</p>
