kubernetespersistent-volumespersistent-volume-claimsokteto

Share PersistentVolumeClaims between pods/deployments on Okteto


With Okteto Cloud, in order to let different pods/deployments access a shared PersistentVolumeClaim, I tried setting the PersistentVolumeClaim's accessModes to "ReadWriteMany":

{
    "kind": "PersistentVolumeClaim",
    "apiVersion": "v1",
    "metadata": {
        "name": "pv-claim-cpdownloads"
    },
    "spec": {
        "accessModes": [
            "ReadWriteMany"
        ],
        "resources": {
            "requests": {
                "storage": "10Gi"
            }
        }
    }
}

Applying my deployment with kubectl succeeds, but the deployment itself times out on the okteto web UI, with the error:

pod has unbound immediate PersistentVolumeClaims (repeated 55 times)

Now, the same PersistentVolumeClaim with accessModes set to "ReadWriteOnce" deploys just fine.

Is the accessMode "ReadWriteMany" disallowed on Okteto Cloud ?

If it is, how could I get several pods/deployments to access the same volume data ?

For precisions, in my case I think I technically only need one pod to write to the volume and the other one to read from it.

My use case is to have one container save files to a folder, and another container watches changes and loads files from that same folder.


Solution

  • Okteo Cloud only supports the "ReadWriteOnce" access mode. If you share the volume between pods/deployments they will all go to the same node, which is equivalent to have a single reader/writer. But it is not a recommended practice.

    What is your use case? why do you need to share volumes?