3

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
  • 30,145
  • 48
  • 175
  • 286

1 Answers1

3

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
  • 25,074
  • 5
  • 73
  • 75