<p>I tried to create standalone rabbitmq kubernetes service. And the data should be mount to my persistent volume.</p>

<pre><code>.....
apiVersion: v1
kind: ConfigMap
metadata:
  name: rabbitmq-config
data:
  enabled_plugins: |
      [rabbitmq_management,rabbitmq_peer_discovery_k8s].
  rabbitmq.conf: |
        loopback_users.guest = false
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: standalone-rabbitmq
spec:
  serviceName: standalone-rabbitmq
  replicas: 1
  template:
        .....
        volumeMounts:
          - name: config-volume
            mountPath: /etc/rabbitmq
          - name: standalone-rabbitmq-data
            mountPath: /data
        - name: config-volume
          configMap:
            name: rabbitmq-config
            items:
            - key: rabbitmq.conf
              path: rabbitmq.conf
            - key: enabled_plugins
              path: enabled_plugins
        - name: standalone-rabbitmq-data
          persistentVolumeClaim:
            claimName: standalone-rabbitmq-pvc-test
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: standalone-rabbitmq-pvc-test
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: test-storage-class
</code></pre>

<p>According to my research, I understood that data directory of rabbitmq is <strong>RABBITMQ_MNESIA_DIR</strong> (please see <a href="https://www.rabbitmq.com/relocate.html" rel="nofollow noreferrer">https://www.rabbitmq.com/relocate.html</a>). So I just wanted to set this parameter “/data”, so that my new PVC(standalone-rabbitmq-pvc-test) is used to keep the data.
Can you tell me how to configurate this?</p>

<p>HTH, So pretty much here's my configuration. From which you can see there are mount points. First is the data, second is config and third is definitions respectively as in the YML mentioned below.</p>

<pre><code>     volumeMounts:
    - mountPath: /var/lib/rabbitmq
      name: rmqdata
    - mountPath: /etc/rabbitmq
      name: config
    - mountPath: /etc/definitions
      name: definitions
      readOnly: true
</code></pre>

<p>And here's the PVC template stuff. </p>

<pre><code>volumeClaimTemplates:
- metadata:
  creationTimestamp: null
  name: rmqdata
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: nfs-provisioner
  volumeMode: Filesystem
</code></pre>

<hr>

<p>Post Update:  As per the comments, you can mount it directly to the <code>data</code> folder like this. The section where you assign the <code>rmqdata</code> to mountpath will stay the same. </p>

<pre><code>  volumes:
  - hostPath:
      path: /data
      type: DirectoryOrCreate
    name: rmqdata
</code></pre>
