<p>I'm trying to deploy a rabbitmq pod in my kubernetes. So I use the rabbitmq hosted by Google : <a href="https://github.com/GoogleCloudPlatform/rabbitmq-docker/blob/master/3/README.md#connecting-to-a-running-rabbitmq-container-kubernetes" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/rabbitmq-docker/blob/master/3/README.md#connecting-to-a-running-rabbitmq-container-kubernetes</a></p>

<p>In the documentation, it is said :
Starting a RabbitMQ instance</p>

<p>Replace <code>your-erlang-cookie</code> with a valid cookie value. For more information, see <code>RABBITMQ_ERLANG_COOKIE in</code> Environment Variable.</p>

<p>Copy the following content to pod.yaml file, and run kubectl create -f pod.yaml.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: some-rabbitmq
  labels:
    name: some-rabbitmq
spec:
  containers:
    - image: launcher.gcr.io/google/rabbitmq3
      name: rabbitmq
      env:
        - name: "RABBITMQ_ERLANG_COOKIE"
          value: "unique-erlang-cookie"
</code></pre>

<p>How could I generate the cookie erlang ?  I find nothing after days of searching on internet. I have a rabbitmq installed in my windows, I never generated a cookie erlang.</p>

<p>Please how could I do ? Thanks</p>

Teddy Kossoko
<p>It's any unique value; the only constraint is that every connected instance of RabbitMQ (that is, every Pod in your StatefulSet) has the same cookie value.</p>

<p>A good way to specify this is with a <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="noreferrer">Secret</a>:</p>

<pre class="lang-yaml prettyprint-override"><code>env:
  - name: RABBITMQ_ERLANG_COOKIE
    valueFrom:
      secretKeyRef:
        name: rabbitmq
        key: erlangCookie
</code></pre>

<p>This requires you to create the Secret.  Just to bring this up, you can run a one-off imperative command to create a random Secret:</p>

<pre class="lang-sh prettyprint-override"><code>kubectl create secret generic rabbitmq \
  --from-literal=erlangCookie=$(dd if=/dev/urandom bs=30 count=1 | base64)
</code></pre>

<p>For actual production use you'd need to store that credential somewhere safe and be able to inject (or recreate) it at deployment time.  Managing that is a little beyond the scope of this question.</p>
