Kubernetes Permission denied for mounted nfs volume
Have you tried initContainers method? It fixes permissions on an exported directory:
initContainers: - name: volume-mount-hack image: busybox command: ["sh", "-c", "chmod -R 777 /exports"] volumeMounts: - name: nfs mountPath: /exports
If you use a standalone NFS server on Linux box, I suggest using no_root_squash option:
/exports *(rw,no_root_squash,no_subtree_check)
To manage the directory permission on nfs-server, there is a need to change security context and raise it to privileged mode:
apiVersion: v1kind: Podmetadata: name: nfs-server labels: role: nfs-serverspec: containers: - name: nfs-server image: nfs-server ports: - name: nfs containerPort: 2049 securityContext: privileged: true