<p>RabbitMQ cannot start when using azure fileShare as storage of rabbit volume. It is throwing error</p>
<p><code>Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by owner only</code></p>
<p>I cannot do <code>chmod 400 /var/lib/rabbitmq/.erlang.cookie</code> since the pods is crashing before start.</p>
<p>Anyone having a similar issue?</p>
<p>Below is my manifest file.</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-azure-file-static-mi
  labels:
    app.kubernetes.io/name: csi-test
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteMany
  csi:
    driver: file.csi.azure.com
    readOnly: false    
    volumeHandle: csi-test-109222 
    volumeAttributes:
      resourceGroup: RG
      storageAccount: test
      shareName: bob3
  mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=1000
  - gid=1000
  - mfsymlinks
  - nobrl
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-azure-file-static-mi
  labels:
    app.kubernetes.io/name: csi-test
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: &quot;&quot;
  volumeName: pv-azure-file-static-mi
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  name: rabbit
  labels:
    app: rabbit
    name: rabbit
spec:
  type: NodePort
  ports:
    - port: 15672
      targetPort: 15672
  selector:
    app: rabbit
    name: rabbit

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rabbit
  labels:
    app: rabbit
    name: rabbit
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbit
      name: rabbit
  template:
    metadata:
      labels:
        app: rabbit
        name: rabbit
    spec:
      hostname: rabbit
      containers:
      - name: rabbit
        image: rabbitmq:3.8.0-management
        imagePullPolicy: Always
        ports:
          - name: http
            containerPort: 15672
            protocol: TCP
          - name: amqp
            containerPort: 5672
            protocol: TCP
        resources:
          limits:
            cpu: 1
            memory: 1024Mi
          requests:
            cpu: 200m
            memory: 512Mi
        volumeMounts:
        - name: volume
          mountPath: &quot;/var/lib/rabbitmq&quot;
      volumes:
        - name: volume
          persistentVolumeClaim:
            claimName: pvc-azure-file-static-mi
</code></pre>
<p>Logs</p>
<blockquote>
<p>Cookie file /var/lib/rabbitmq/.erlang.cookie must be accessible by
owner only 2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
supervisor: {local,net_sup} 2022-03-10 06:55:02.847364+00:00 [erro]
&lt;0.143.0&gt;     errorContext: start_error 2022-03-10
06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;     reason: {&quot;Cookie file
/var/lib/rabbitmq/.erlang.cookie must be accessible by owner only&quot;,
2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
[{auth,init_no_setcookie,0,[{file,&quot;auth.erl&quot;},{line,293}]}, 2022-03-10
06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{auth,init,1,[{file,&quot;auth.erl&quot;},{line,144}]}, 2022-03-10
06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{gen_server,init_it,2,[{file,&quot;gen_server.erl&quot;},{line,423}]},
2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{gen_server,init_it,6,[{file,&quot;gen_server.erl&quot;},{line,390}]},
2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{proc_lib,init_p_do_apply,3, 2022-03-10 06:55:02.847364+00:00 [erro]
&lt;0.143.0&gt;<br />
[{file,&quot;proc_lib.erl&quot;},{line,226}]}]} 2022-03-10 06:55:02.847364+00:00
[erro] &lt;0.143.0&gt;     offender: [{pid,undefined}, 2022-03-10
06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;                {id,auth},
2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{mfargs,{auth,start_link,[]}}, 2022-03-10 06:55:02.847364+00:00 [erro]
&lt;0.143.0&gt;                {restart_type,permanent}, 2022-03-10
06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{significant,false}, 2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;
{shutdown,2000}, 2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;<br />
{child_type,worker}] 2022-03-10 06:55:02.847364+00:00 [erro] &lt;0.143.0&gt;
2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;   crasher:
2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;     initial call:
auth:init/1 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;     pid:
&lt;0.145.0&gt; 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
registered_name: [] 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;
exception error: &quot;Cookie file /var/lib/rabbitmq/.erlang.cookie must be
accessible by owner only&quot; 2022-03-10 06:55:02.847486+00:00 [erro]
&lt;0.145.0&gt;       in function  auth:init_no_setcookie/0 (auth.erl, line
293) 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;       in call
from auth:init/1 (auth.erl, line 144) 2022-03-10 06:55:02.847486+00:00
[erro] &lt;0.145.0&gt;       in call from gen_server:init_it/2
(gen_server.erl, line 423) 2022-03-10 06:55:02.847486+00:00 [erro]
&lt;0.145.0&gt;       in call from gen_server:init_it/6 (gen_server.erl,
line 390) 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
ancestors: [net_sup,kernel_sup,&lt;0.47.0&gt;] 2022-03-10
06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;     message_queue_len: 0
2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;     messages: []
2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;     links:
[&lt;0.143.0&gt;] 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
dictionary: [] 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
trap_exit: true 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
status: running 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
heap_size: 610 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
stack_size: 29 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
reductions: 2022 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;<br />
neighbours: 2022-03-10 06:55:02.847486+00:00 [erro] &lt;0.145.0&gt;
2022-03-10 06:55:02.855931+00:00 [erro] &lt;0.130.0&gt; 2022-03-10
06:55:02.855931+00:00 [erro] &lt;0.130.0&gt; BOOT FAILED 2022-03-10
06:55:02.855931+00:00 [erro] &lt;0.130.0&gt; =========== 2022-03-10
06:55:02.855931+00:00 [erro] &lt;0.130.0&gt; Exception during startup:
2022-03-10 06:55:02.855931+00:00 [erro] &lt;0.130.0&gt;</p>
</blockquote>

Buba Conteh
<p>Switching to rabbitMQ version <code>v3.9.9</code> from <code>v3.8.0</code> and mounting <code>/var/lib/rabbitmq/mnesia</code> instead of <code>/var/lib/rabbitmq</code> solves the issue for me in mounting rabbitmq volume to fileshare in Azure.</p>
