I have a container which is using shared volume with host. I want to give it a full permissions. At present, it is:
ls -l
drwxr-xr-x 8 user user 4096 Aug 9 04:47 Data
But I want it to be:
ls -l
drwxrwxrwx 8 user user 4096 Aug 9 04:47 Data
I have a below deployment file:
----
----
spec:
containers:
- name: logger
image: logger_image
volumeMounts:
- mountPath: /Data
name: Data-files
securityContext:
privileged: true
volumes:
- name: Data-files
hostPath:
path: /home/user/Documents/Data
----
----
I have even set it as privileged
but still, the volumes do not have full permissions. What should I add in deployment file to make the volume full permissions?
Thanks
Your permissions on /home/user/
or /home/user/Documents/
folders don't allow the process' owner (of logger_image) to access the folder and write.
Try to create /Data
(on your root) and set the proper permissions.
I resolved this issue by mentioning the appropriate commands to give full permissions to that directory in the Dockerfile
itself.
In the dockerfile:
RUN mkdir -p /Data
RUN chmod 777 -R Data/
and then later used the same kubernetes deployment file and it worked fine with full permissions.
Thanks