I have a problem with access permissions for group when mounting the NFS folder to the K8s POD. When a file is created within the pod the permissions are read-only for the group on the NFS server.
(A) I have tried to set the security context on the pod:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
The id (1000) is the same as the group id on the NFS server.
(B) Also I tried with initContainer param:
initContainers:
name: test
image: imagename
command: ["/bin/chmod","-R","660", "/data"]
With this both case solutions the new created files have the following permissions which is not acceptable:
-rw-r--r-- 1 1000 1000 test.txt
I have succeeded to create files within a pod with the needed permissions:
-rw-rw-r-- 1 1000 1000 test.txt
Only if I create a user on the running pod and switch to it with the same ID on the NFS server.
I would recommend you to use one of the two below Method: Modify security context securityContext: runAsGroup: 65534 runAsUser: 65534 Method 2: Create an empty directory and mount it. This should solve - emptyDir: {} name: data mount it on to some volume /data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.