<p>I'm in a progress to migrate to kuberenetes from docker-compose.
One of the services we're using is rabbit-mq.
When I try to deploy rabbit-mq 3.6.16-management I receive the error:</p>

<p><em>/usr/local/bin/docker-entrypoint.sh: line 382: /etc/rabbitmq/rabbitmq.config: Permission denied.</em></p>

<p>While it works in docker-compose deployment.</p>

<p><strong>Kuberentes</strong>:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rabbit-mq
  name: rabbit-mq
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbit-mq
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
         app: rabbit-mq
    spec:
      containers:
      - image: rabbitmq:3.6.16-management
        name: rabbit-mq
        ports:
        - containerPort: 15671
        - containerPort: 5671
        volumeMounts:
        - mountPath: /etc/rabbitmq
          name: rabbit-mq-data
      restartPolicy: Always
      hostname: rabbit-mq
      volumes:
      - name: rabbit-mq-data
        persistentVolumeClaim:
          claimName: rabbit-mq-data
</code></pre>

<p><strong>PVC:</strong></p>

<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: rabbit-mq-data
  name: rabbit-mq-data
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 16Gi
</code></pre>

<p><strong>PV:</strong></p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: rabbit-mq-data
  labels:
    type: local
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 16Gi
  hostPath:
    path: "/etc/rabbitmq"
</code></pre>

<p><strong>Docker-Compose:</strong></p>

<pre><code>  rabbit-mq:
      image: rabbitmq:3.6.16-management
      ports:
        - "15671:15671"
        - "5671:5671"
      container_name: rabbit-mq
      volumes:
        - rabbit-mq-data:/etc/rabbitmq
      restart: on-failure:5
</code></pre>

Oren Ashkenazy
<p>Eventually I've used configmap and secrets to mount files instead of PV and works as expected.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rabbit-mq
  name: rabbit-mq
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rabbit-mq
  template:
    metadata:
      labels:
         app: rabbit-mq
    spec:
      containers:
      - image: rabbitmq:3.6.16-management
        name: rabbit-mq
        ports:
        - containerPort: 15671
        - containerPort: 5671
        volumeMounts:
        - name: rabbit-mq-data
          mountPath: /etc/rabbitmq
          readOnly: false
        - name: mq-secret
          mountPath: /etc/rabbitmq/certfiles
          #readOnly: true
      volumes:
        - name: mq-secret
          secret:
            defaultMode: 420
            secretName: rabbit-mq-secrets
        - configMap:
            defaultMode: 420
            items:
            - key: rabbitmq.config
              path: rabbitmq.config
            name: mq-config
          name: rabbit-mq-data
</code></pre>
