<p>Currently I am troubleshooting an issue that I have with some points and I found that when I run a container with <code>docker run</code> command with the following argument: </p>

<p><code>-v /var/run:/var/run:rw</code></p>

<p>When I inspect the container I can see the following:</p>

<pre><code>{
    "Type": "bind",
    "Source": "/var/run",
    "Destination": "/var/run",
    "Mode": "rw",
    "RW": true,
    "Propagation": "rprivate"
}
</code></pre>

<p>I can't find the way of set <strong>"Mode": "rw"</strong> inside of the MountPaths / Volume definition of a Pod.</p>

<p>I am using:</p>

<pre><code>    volumeMounts:
    - mountPath: /var/run
      name: var-run-mount

  volumes:
  - name: var-run-mount
    hostPath:
      path: /var/run
</code></pre>

<p>and when I inspect the container, I got this:</p>

<pre><code>        {
            "Type": "bind",
            "Source": "/var/run",
            "Destination": "/var/run",
            "Mode": "",
            "RW": true,
            "Propagation": "rprivate"
        },
</code></pre>

<p>I have tried different combinations and MountPropragation but no one helped to achieve what I am looking for and no one also was able to define that "Mode" attribute.</p>

<p><a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/volumes/#hostpath</a></p>

<p>Does someone know if that is possible to be defined?</p>

Penguin_HuHu
<p>Check out <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">access modes</a> of kubernetes Persistent Volumes.</p>

<p>You can set <code>accessModes: ReadWriteOnce</code> for the <code>hostPath</code> volume.</p>

<p><strong><em>NOTE:</strong> Unfortunately <code>hostPath</code> volume supports only <code>ReadWriteOnce</code> accessMode, other modes like <code>ReadOnlyMany</code>, <code>ReadWriteMany</code> are not supported, as mentioned <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">here</a> in the table.</em></p>

<p>You need to:</p>

<ul>
<li>First create <code>hostPath PersistentVolume</code> as mentioned <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolume" rel="nofollow noreferrer">here</a>.</li>
<li>And then create <code>persistentvolumeclaim</code> as mentioned <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolumeclaim" rel="nofollow noreferrer">here</a>.</li>
<li>Finally create a Pod referring to that hostPath volume resource as mentioned <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-pod" rel="nofollow noreferrer">here</a>.</li>
</ul>

<p>Hope this helps.</p>
