Volume claim on GKE / Multi-Attach error for volume Volume is already exclusively attached

后端 未结 2 1412
面向向阳花
面向向阳花 2021-02-19 03:12

The problem seems to have been solved a long time ago, as the answer and the comments does not provide real solutions, I would like to get some help from experienced users

相关标签:
2条回答
  • 2021-02-19 03:42

    Your Deployment yaml shows 5 replicas, which will not work with GCE PD in ReadWriteOnce mode. GCE PD can only be attached to multiple nodes in ReadOnlyMany mode.

    If you need shared, writable storage across all replicas, then you should look into a multi-writer solution like NFS or Gluster.

    If you want each replica to have its own disk, then you can use StatefulSets, which will have a PVC per replica.

    0 讨论(0)
  • 2021-02-19 03:49

    Based on your description what you are experiencing is exactly what is supposed to happen.

    You are using gcePersistentDisk in your PV/PVC definition. The accessMode is ReadWriteOnce - this means that this PV can only be attached to a single Node (stressing Node here, there can be multiple Pods running on the same Node using the same PV). There is not much you can do about this; gcePersistentDisk is like a remote block device, it's not possible to mount it on multiple Nodes simultaneously (unless read only).

    There is a nice table that shows which PVs support ReadWriteMany (that is, write access on multiple Nodes at the same time):

    Important! A volume can only be mounted using one access mode at a time, even if it supports many. For example, a GCEPersistentDisk can be mounted as ReadWriteOnce by a single node or ReadOnlyMany by many nodes, but not at the same time.

    0 讨论(0)
提交回复
热议问题