<p>I am trying to create a deployment in GKE that uses multiple replicas. I have some static data which I want to have available in every pod. This data will not be updated, no write is required.</p>

<p>I decided to use a PV with a corresponding PVC with the ReadOnlyMany storage class. The thing is, I do not know how to actually transfer my data to the volume - since it is read-only. I tried using </p>

<pre><code>gcloud compute scp /local/path instance:/remote/path
</code></pre>

<p>but of course, I get a permission error. I then tried creating a new PV via the console. I attached it to a VM with</p>

<pre><code>gcloud compute instances attach disk
</code></pre>

<p>mounted and formatted the disk, transfered my data, unmounted the disk, detached it from the VM and finally created a PVC following <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/preexisting-pd" rel="noreferrer">the documentation</a>. I changed the storage class to ReadOnlyMany, the only difference.</p>

<p>But still, when I'm trying to scale my deployment to more than one replicas I get an error saying the disk is already attached to another node.</p>

<p>So, how can I create a volume that is to be used in ReadOnlyMany and populate the disk with data? Or is there a better approach since no write is required?</p>

<p>Thanks in advance</p>

Nikolaos Paschos
<p>Worked for me. Have you specified <code>readOnly: true</code> when using persistent volume claim in the Pod template?</p>

<pre><code>volumes:
- name: my-volume
  persistentVolumeClaim:
    claimName: my-readonly-pvc
    readOnly: true
</code></pre>

<p>See details here
<a href="https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/readonlymany-disks" rel="nofollow noreferrer">https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/readonlymany-disks</a></p>
