MySQL with Kubernetes Persistent Volume Access Modes (GKE)

12/4/2020

I have a 3 node cluster. What I am going to do is create a persistence volume with ReadWriteMany access mode for MySQL Deployment. Also, Mount Option is GCEPersistentDisk. My question is if I could use ReadWriteMany access mode for MySQL deployment, Will it be an issue? Because the volume can be mounted by many nodes. if I am wrong please correct me.

-- YMA
google-kubernetes-engine
kubernetes

2 Answers

12/4/2020

Yes it can be an issue when the backend doesn't support ReadWriteMany, however, as per my knowledge MySQL supports ReadWriteMany. So it should not be an issue in your case.

-- Vikrant
Source: StackOverflow

12/9/2020

GCE persistent disks do not support ReadWriteMany. You can see this here in the documentation: ` https://cloud.google.com/kubernetes-engine/docs/concepts/persistent-volumes#access_modes

However, there is a workaround to achieve the same with a NFS server:
https://medium.com/@Sushil_Kumar/readwritemany-persistent-volumes-in-google-kubernetes-engine-a0b93e203180

I wouldn't recommend this as the MySQL performance will be suboptimal, though. Consider using a Cloud SQL instance instead, and connecting from multiple nodes nodes to that using MySQL protocol instead of accessing the disk.

-- Alberto Pau
Source: StackOverflow