<p>I'm using Kubernetes on azure and my architecture is attached as image.</p>

<p>I could create a persistent volume using azure files and i attached it to my pods using persistent volume claim.</p>

<p>My problem is:</p>

<p>As you can see on the image there is files and directories on the azure files and i need to set special permissions on theses files/directories </p>

<p>for example</p>

<ul>
<li>notes.txt with ( rw--) </li>
<li>user1 to be the owner of the directory data</li>
<li>user2 to be the owner of tools</li>
<li>in tools format have the permission
(rwx-rw-r) and stats (rwx-r-r)   </li>
</ul>

<p>I asked about this feature and it's not implemented on  azure files. Can you suggest any other solution ?</p>

<p>Thank you in advance.</p>

<p>Regards,</p>

<p>Hajjim</p>

<p><a href="https://i.stack.imgur.com/FQXZi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FQXZi.png" alt="enter image description here"></a></p>

hajji_0081
<p>You can use kubernetes security context to configure access to your mounts. Check this link <a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/security-context/</a></p>

<p>Quoting the docs:</p>

<p><em>Since fsGroup field is specified, all processes of the container are also part of the supplementary group ID 2000. The owner for volume /data/demo and any files created in that volume will be Group ID 2000.</em></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: security-context-demo
spec:
  securityContext:
    runAsUser: 1000
    runAsGroup: 3000
    fsGroup: 2000
  volumes:
  - name: sec-ctx-vol
    emptyDir: {}
  containers:
  - name: sec-ctx-demo
    image: busybox
    command: [ "sh", "-c", "sleep 1h" ]
    volumeMounts:
    - name: sec-ctx-vol
      mountPath: /data/demo
    securityContext:
      allowPrivilegeEscalation: false
</code></pre>
