<p>It seems that Kubernetes supports 3 kinds of access mode for persistent volume: <code>ReadWriteOnce</code>, <code>ReadOnlyMany</code>, <code>ReadWriteMany</code>.
I'm really curious about the scheduler strategy for a pod which uses the <code>ReadWriteOnce</code> mode volume. For example, I created an RC which have pod num=2, I guess the two pods will be scheduled into the same host because they use the volume that has <code>ReadWriteOnce</code> mode? 
I really want to know the source code of this part.</p>

wangzhe
<p>I think <a href="https://stackoverflow.com/a/37650159">DavidO's answer</a> is wrong.  As per Kubernetes docs on <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">Access Modes</a>:</p>
<blockquote>
<p>The access modes are:</p>
<ul>
<li>ReadWriteOnce -- the volume can be mounted as read-write <strong>by a single node</strong></li>
<li>ReadOnlyMany -- the volume can be mounted read-only <strong>by many nodes</strong></li>
<li>ReadWriteMany -- the volume can be mounted as read-write by many nodes</li>
</ul>
</blockquote>
<p>So AccessModes as defined today, only describe node attach (not pod mount) semantics, and doesn't enforce anything.</p>
<p>So to prevent two pods mount the same PVC even if they are scheduled to be run on the same node you can use pod anti-affinity. It is not the same as not to mount one volume to 2 pods scheduled on the same node. But anti-affinity can be used to ask scheduler not to run 2 pods on the same node. Therefore it prevents mounting one volume into 2 pods.</p>
