I would like to use persistent disk in my replication controller but if i use a gcePersistentDisk
the console returns me an error
ReadOnly must be true for replicated pods > 1, as GCE PD can only be mounted on multiple machines if it is read-only.
From the error message and from the docs:
A feature of PD is that they can be mounted as read-only by multiple consumers simultaneously. This means that you can pre-populate a PD with your dataset and then serve it in parallel from as many pods as you need. Unfortunately, PDs can only be mounted by a single consumer in read-write mode - no simultaneous readers allowed.
So you have two options to fix this:
replicas
in your ReplicationController to 1Make the volume readOnly: true
gcePersistentDisk:
pdName: my-data-disk
fsType: ext4
readOnly: true