Can a GCP persistent disk be be mounted/claimed by multiple pods in ReadWriteMany mode?

8/15/2017

I've got a persistent disk (GCP), that I'm hoping to be able to allow read write access to multiple pods.

Is this possible? Here are my two configs:

pVolume.yaml

apiVersion: "v1"
kind: "PersistentVolume"
metadata:
  name: "pv0001" 
spec:
  storageClassName: manual
  capacity:
    storage: "10Gi" 
  accessModes:
    - "ReadWriteMany"
  gcePersistentDisk: 
    fsType: "ext4" 
    pdName: "wordpress-disk" 

pVolumeClaim.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: task-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 3Gi

With the above config, I see the following error on my pods:

FailedMount Failed to attach volume "pv0001" on node "xyz" with: googleapi: Error 400: The disk resource 'abc' is already being used by 'xyz'

This occurs with the replica count set to 2.

-- Chris Stryczynski
google-cloud-platform
google-kubernetes-engine
kubernetes
persistent-volume-claims
persistent-volumes

1 Answer

8/15/2017

For a GCP persistent disk in ReadWrite mode on different nodes this is not possible :(

It is possible however:

  • Have both replicas scheduled on the same node. In that case both of them can mount the same persistent disk ReadWrite
  • Use it in ReadOnly mode, on any number of nodes
  • Use a different kind of PV, like gluster or nfs that supports this kind of use
-- Janos Lenart
Source: StackOverflow