Rabbitmq in Kubernetes: Command not found

5/18/2020

Trying to start up rabbitmq in K8s while attaching a configmap gives me the following error:

/usr/local/bin/docker-entrypoint.sh: line 367: rabbitmq-plugins: command not found
/usr/local/bin/docker-entrypoint.sh: line 405: exec: rabbitmq-server: not found

Exactly the same setup is working fine with docker-compose, so I am a bit lost. Using rabbitmq:3.8.3

Here is a snippet from my deployment:

  "template": {
      "metadata": {
        "creationTimestamp": null,
        "labels": {
          "app": "rabbitmq"
        }
      },
      "spec": {
        "volumes": [
          {
            "name": "rabbitmq-configuration",
            "configMap": {
              "name": "rabbitmq-configuration",
              "defaultMode": 420
            }
          }
        ],
        "containers": [
          {
            "name": "rabbitmq",
            "image": "rabbitmq:3.8.3",
            "ports": [
              {
                "containerPort": 5672,
                "protocol": "TCP"
              }
            ],
            "env": [
              {
                "name": "RABBITMQ_DEFAULT_USER",
                "value": "guest"
              },
              {
                "name": "RABBITMQ_DEFAULT_PASS",
                "value": "guest"
              },
              {
                "name": "RABBITMQ_ENABLED_PLUGINS_FILE",
                "value": "/opt/enabled_plugins"
              }
            ],
            "resources": {},
            "volumeMounts": [
              {
                "name": "rabbitmq-configuration",
                "mountPath": "/opt/"
              }
            ],
            "terminationMessagePath": "/dev/termination-log",
            "terminationMessagePolicy": "File",
            "imagePullPolicy": "IfNotPresent"
          }
        ],
        "restartPolicy": "Always",
        "terminationGracePeriodSeconds": 30,
        "dnsPolicy": "ClusterFirst",
        "securityContext": {},
        "schedulerName": "default-scheduler"
      }
    },

And here is the configuration:

{
  "kind": "ConfigMap",
  "apiVersion": "v1",
  "metadata": {
    "name": "rabbitmq-configuration",
    "namespace": "e360",
    "selfLink": "/api/v1/namespaces/default/configmaps/rabbitmq-configuration",
    "uid": "28071976-98f6-11ea-86b2-0244a03303e1",
    "resourceVersion": "1034540",
    "creationTimestamp": "2020-05-18T10:55:58Z"
  },
  "data": {
    "enabled_plugins": "[rabbitmq_management].\n"
  }
}
-- Giannis
docker
kubernetes
rabbitmq

1 Answer

5/18/2020

That's because you're monting a volume in /opt, which is the rabbitmq home path.

So, the entrypoint script cannot find any of the rabbitmq binaries.
You can see the rabbitmq Dockerfile here

-- Marc ABOUCHACRA
Source: StackOverflow