Cannot read/write/access Persistent Volume mount on Kubernetes?

If your release container has non-root privileges then you might not be able to write to the mounted volume. This is a known issue with Linode's CSI Driver (which creates the Persistent Volume from the Persistent Volume Claim).

Run this JSON Patch and recreate the release (making sure to delete the PVC, which is kept by default) and the problem should be fixed:

kubectl -n kube-system patch sts csi-linode-controller --type='json' \
-p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--default-fstype=ext4"}]'

1 Reply

I think this is reported at https://github.com/linode/linode-blockstorage-csi-driver/issues/80 .

From the workarounds points of view, I typically set up an init containers that runs a chown, along the lines of

  - name: fix-linode-perms
    image: alpine:3
    command: ["/bin/sh", "-c", "chown -R 65534:65534 /data"]
    volumeMounts:
      - name: storage-volume
        mountPath: /data
    securityContext:
      runAsUser: 0

Of course, the volume name and UID/GID need to be adjusted for each deployment.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct