Share persistent volume claim with more than one pod

7/2/2019

Cant share a PVC with multiple pods in the GCP (with the GCP-CLI)

When I apply the config with ReadWriteOnce works at once

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
    name: <name>
    namespace: <namespace>
spec:
    accessModes:
        - ReadWriteMany
    resources:
    requests:
        storage: 50Gi

But with ReadWriteMany the status hangs on pending

Any ideas?

-- Yafar Valverde
google-kubernetes-engine
kubernetes

3 Answers

7/2/2019
-- Ijaz Ahmad Khan
Source: StackOverflow

7/2/2019

Referring to the Kubernetes-Documentation, GCE does not support ReadWriteMany-Storage: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes

-- Alex
Source: StackOverflow

7/2/2019

So it is normal that when you apply the config with ReadWriteOnce works at once, that's the rule.

ReadWriteOnce is the most common use case for Persistent Disks and works as the default access mode for most applications.

GCE persistent disk do not support ReadWriteMany !

enter image description here Instead of ReadWriteMany, you can just use ReadOnlyMany. More information you can find here: persistentdisk. But as you now result will not be the same as you want.

If you want to share volumes you could try some workarounds:

You can create services.

Your service should look after the data that is related to its area of concern and should allow access to this data to other services via an interface. Multi-service access to data is an anti-pattern akin to global variables in OOP.

If you where looking to write logs, you should have a log service which each service can call with the relevant data it needs to log. Writing directly to a shared disk means that you'd need to update every container if you change your log directory structure or add extra features.

Also try to use high-performance, fully managed file storage for applications that require a file system interface and a shared file system. More information you can find here: access-fileshare.

-- MaggieO
Source: StackOverflow