RabbitMQ Cluster Kubernetes Operator on minikube

94 views
Skip to first unread message

W-K-S

unread,
Oct 7, 2020, 3:03:38 AM10/7/20
to rabbitmq-users

I'm trying to set up RabbitMQ on Minikube using the RabbitMQ Cluster Operator:

When I try to attach a persistent volume, I get the following error:

$ kubectl logs -f rabbitmq-rabbitmq-server-0 Configuring logger redirection 20:04:40.081 [warning] Failed to write PID file "/var/lib/rabbitmq/mnesia/rab...@rabbitmq-rabbitmq-server-0.rabbitmq-rabbitmq-headless.default.pid": permission denied 20:04:40.264 [error] Failed to create Ra data directory at '/var/lib/rabbitmq/mnesia/rab...@rabbitmq-rabbitmq-server-0.rabbitmq-rabbitmq-headless.default/quorum/rab...@rabbitmq-rabbitmq-server-0.rabbitmq-rabbitmq-headless.default', file system operation error: enoent 20:04:40.265 [error] Supervisor ra_sup had child ra_system_sup started with ra_system_sup:start_link() at undefined exit with reason {error,"Ra could not create its data directory. See the log for details."} in context start_error 20:04:40.266 [error] CRASH REPORT Process <0.247.0> with 0 neighbours exited with reason: {error,"Ra could not create its data directory. See the log for details."} in ra_system_sup:init/1 line 43 20:04:40.267 [error] CRASH REPORT Process <0.241.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,ra_system_sup,{error,"Ra could not create its data directory. See the log for details."}}},{ra_app,start,[normal,[]]}} in application_master:init/4 line 138 {"Kernel pid terminated",application_controller,"{application_start_failure,ra,{{shutdown,{failed_to_start_child,ra_system_sup,{error,\"Ra could not create its data directory. See the log for details.\"}}},{ra_app,start,[normal,[]]}}}"} Kernel pid terminated (application_controller) ({application_start_failure,ra,{{shutdown,{failed_to_start_child,ra_system_sup,{error,"Ra could not create its data directory. See the log for details."} Crash dump is being written to: erl_crash.dump...

The issue is that RabbitMQ is not able to set up its data files in the data directory /var/lib/rabbitmq/mnesia due to a lack of permission.

My initial guess was that I needed to specify the data directory as a volumeMount, but that doesn't seem to be configurable according to the documentation.

I tried to find other resources online with the same problem but none of them were using the RabbitMQ Cluster Operator. I plan on following that route if I'm not able to find a solution but I really would like to solve this issue somehow.

Does anyone have any ideas?

The setup that I have is as follows:

apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
  name: rabbitmq
spec:
  replicas: 1
  service:
    type: NodePort
  persistence:
    storageClassName: local-storage
    storage: 20Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: rabbitmq-pvc
spec:
  storageClassName: local-storage
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: rabbitmq-pv
spec:
  storageClassName: local-storage
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 20Gi
  hostPath:
    path: /mnt/app/rabbitmq
    type: DirectoryOrCreate

David Ansari

unread,
Oct 7, 2020, 12:17:07 PM10/7/20
to rabbitmq-users
"HostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this."

What is your use case to use a hostPath volume mount?

"The files or directories created on the underlying hosts are only writable by root. You either need to run your process as root in a privileged Container or modify the file permissions on the host to be able to write to a hostPath volume"
The rabbitmq container does not run as root.

As a side note: You don't need to define the PersistentVolumeClaim. That's done already in https://github.com/rabbitmq/cluster-operator/blob/cce318fffddb1e003b09e4f992d0111011aa5074/internal/resource/statefulset.go#L105-L121.


David Ansari

unread,
Oct 7, 2020, 12:21:08 PM10/7/20
to rabbitmq-users
Reply all
Reply to author
Forward
0 new messages