Mount options not being used? #939
-
I need to set uid and gid for proper permissions within a container and I can't seem to get the it working as expected. Here is my pv ---
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: smb.csi.k8s.io
name: pv-storage-smb
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: smb
mountOptions:
- dir_mode=0755
- file_mode=0644
- uid=1000
- gid=1000
- forceuid
- forcegid
csi:
driver: smb.csi.k8s.io
readOnly: false
volumeHandle: data.host/storage##pv
volumeAttributes:
source: "//data.host/storage"
nodeStageSecretRef:
name: smb-creds
namespace: csi-driver-smb When checking the mounts on the node and from the container it's all still set as uid=0? Checking the mount definitions on the host I have by running
which to me suggests that it's completely ignoring the mount options? I manually mounted the same share with uid/gid settings to confirm that the host/server supports those mount options and that worked fine. Not sure what I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I’ve noted that I have different behavior between nodes, Ubuntu nodes are completely fine, but Debian nodes are forcing to root. |
Beta Was this translation helpful? Give feedback.
-
The answer seems to be that I needed to force down the mount as it was reusing it and justing binding in for the actual volume? I did this by restarting the node completely, but is there a more sane way to achieve this? |
Beta Was this translation helpful? Give feedback.
the application pods that reference the Azure file volume should be restarted after the mount options has been updated. In cases where two pods share the same PVC on the same node, it is necessary to reschedule the pods to a different node without that PVC mounted to ensure that remounting occurs successfully.