0

I want to mount volume into my pod but i am getting permission error when i set runAsUser, runAsGroup and fsGroup.

Steps:

  1. Create new directory /share/pod-1-db
  2. Create new user, group user-1-db => uid=1234 gid=1234
  3. Set ownership chown -R /share/pod-1-db and chmod -R 755 /share/pod-1-db
  4. Apply deployment.yaml where i set: runAsUser, runAsGroup and fsGroup all = 1234
  5. In docker file I create new user 1900:1900 and I set ownership on all directories that I will be modifying.

One way I got it working is just setting fsGroup to the id of created group on the host, but in that case I had to change chmod to 777, what I dont really like.

Can someone please help me understand how to create user/group on host and dockerfile so i will be using proper permissions when container is running?

each container/pod i am running should have its own user inside container so they have only permissions on folder that is really shared with container only on host.

I think this is classic but i can't make it work, kindly asking for help. I was reading this also Write permissions on volume mount with security context fsgroup option but didnt help.

anonf34
  • 313
  • 1
  • 3
  • 8

0 Answers0