<p>I read an article <a href="https://www.stratoscale.com/blog/kubernetes/kubernetes-how-to-share-disk-storage-between-containers-in-a-pod/" rel="nofollow noreferrer">from here</a> which the data is shared in the same Pod with 2 different containers. These 2 containers both have <code>volumnMount</code> on name, <strong>shared-data</strong>. But both of them having different <code>mountPath</code>.</p>
<p><a href="https://i.stack.imgur.com/HKOR5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HKOR5.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/hfPrC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hfPrC.png" alt="enter image description here" /></a></p>
<p>My question is, if these <code>mountPath</code> are not same, how are they sharing data? And what is the path for the volume <strong>shared-data</strong>? My thought is, both should have the same path in order to share data, and i seems like mistaken some concept, but not sure what.</p>

hades
<p>Kubernetes maintains the storage internally.  It doesn't have a fixed path that you can see, and it doesn't matter if it gets mounted in the same place in different containers.</p>
<p>By way of analogy, imagine you have an external USB drive.  If you've unplugged the drive, it doesn't make sense to ask &quot;what is its path&quot;; and if you plug it in and mount it on <code>/mnt/usb</code> on one machine, that doesn't stop you from mounting it on <code>/home/me/app/data</code> when you plug it into a different machine.</p>
<p>The volume does have a name within its pod (in your example, <code>shared-data</code>).  If the volume is backed by a PersistentVolumeClaim that will also have a name.  Potentially the matching PersistentVolume is something like an AWS EBS volume, and <em>that</em> will have a name.  But none of these names are fixed filesystem paths, and for the most part you can't directly use these to access the file content.</p>
