Question

StorageClass does not honour mountOption

It seems the default provisioner in the StorageClass does not honour the mountOptions values. I tried to mount a block storage setting dir and file mode to 0777 and they were mounted with root only permissions. I need to change write permission because my containers run nginx which runs as root www-data. A workaround is to manually change the directory permission via chmod (either when the container starts with the command + args directives or directly logging in into the container).

Here’s my StorageClass and the PersistentVolumeClaims:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: storage-rw
mountOptions:
- dir_mode=0777
- file_mode=0777
provisioner: dobs.csi.digitalocean.com
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: backend
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 5Ti
  storageClassName: storage-rw
---

Note: in azure aks with a storage account paired to the kubernetes shadow resource group and a similar configuration (changing only StorageClass.provisioner: kubernetes.io/azure-file and PersistentVolumeClaim.spec.accessModes: ReadWriteMany) allows me to create dynamic volumes with the correct file permissions.

Subscribe
Share

Nice to see DO, ignoring a question :( I got the same problem

@digitalocean


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This is not the only post on this question and, 3 years later, the question is still ignored. I actually have been paying them for 3 years; might as well bite the bullet and head to AWS. Yuck.