-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with MooseFS CSI Provisioner Creating PV Directories as root:root #17
Comments
Hi! K8s provides the option to use the init container declaration to execute commands before the main application container. With this solution, the UID and GUI of the folder can be easily modified: So fo example: kind: Pod
apiVersion: v1
metadata:
name: my-moosefs-pod
spec:
containers:
- name: my-frontend
image: busybox
volumeMounts:
- mountPath: "/data"
name: moosefs-volume
command: [ "sleep", "1000000" ]
initContainers:
- name: volume-mount-chown
image: busybox
command: ["sh", "-c", "chown -R 1000:1000 /data"]
volumeMounts:
- mountPath: "/data"
name: moosefs-volume
volumes:
- name: moosefs-volume
persistentVolumeClaim:
claimName: my-moosefs-pvc There is also an option to use the extra MooseFS set noowner attribute for a specific folder. mfsseteattr -f noowner /mnt/k8s/data/dir |
Thank you @xandrus for the suggestions. I had to execute mfsseteattr and later run the pod with initContainer to alter the pv directoryd.
|
I was wondering - maybe in your case it would be enough to change the * / rw,admin,maproot=0:1000,alldirs |
Context:
I am using the MooseFS CSI provisioner in my Kubernetes cluster to dynamically create PersistentVolumes (PVs).
Version I am trying is: https://github.com/moosefs/moosefs-csi/blob/v0.9.7
However, the directories created by the provisioner on the MooseFS mount are always owned by root:root.
This causes an issue where pods running with a non-root user (UID 1000) cannot write to the mounted PV, resulting in permission errors.
Problem Details
The MooseFS CSI driver is provisioning PersistentVolumes (PVs) successfully.
However, the created directories inside the MooseFS mount are owned by root:root.
The pods attempting to use the PV run as UID 1000, so they do not have write access.
What I've Tried
Setting fsGroup in the Pod's SecurityContext
Added this to the pod.spec:
Issue: This does not seem to propagate ownership changes inside MooseFS.
Tried setting gid=1000 as mount option csi-moosefs-config.yaml (configmap)
This mount option was rejected
Help me figure out how can I set the PV directory ownership to "root:1000".
The text was updated successfully, but these errors were encountered: