<p>I deployed RabbitMQ in Kubernetes with the manifest below.</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: rabbitmq
  namespace: X 
spec:
  serviceName: rabbitmq
  selector:
    matchLabels:
      app: rabbitmq
  template:
    metadata:
      labels:
        app: rabbitmq
    spec:
      containers:
      - name: rabbitmq
        image: rabbitmq:v01
        ports:
          - containerPort: 15672
            name: rabbitmq
          - containerPort: 5672
        env:
          - name: RABBITMQ_DEFAULT_USER
            value: &quot;...&quot;
          - name: RABBITMQ_DEFAULT_PASS
            value: &quot;...&quot;
        livenessProbe:
          tcpSocket:
            port: 5672
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          tcpSocket:
            port: 5672
          initialDelaySeconds: 10
          periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: rabbitmq
spec:
  ports:
  - port: 5672
    protocol: TCP
    targetPort: 5672
  selector:
    app: rabbitmq
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: rmq
  namespace: X
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`Y`) 
    kind: Rule
    services:
    - name: rabbitmq
      port: 5672
  tls: {}
</code></pre>
<p>After applying this manifest I can see that my pod is running. But when I try to port forward I don't have access to RabbitMQ UI. I have the error 'internal server error' or 'bad gateway'.</p>
<p>In the logs of the pod I can see :</p>
<pre><code>Server startup complete; 3 plugins started.
* rabbitmq_prometheus
* rabbitmq_web_dispatch
* rabbitmq_management_agent
</code></pre>
<p>In the logs I can see:</p>
<pre><code>2023-06-05 21:23:36.319429+00:00 [info] &lt;0.1006.0&gt; accepting AMQP connection &lt;0.1006.0&gt; (IP1:34330 -&gt; IP2:5672)
2023-06-05 21:23:36.319611+00:00 [error] &lt;0.1006.0&gt; closing AMQP connection &lt;0.1006.0&gt; (IP1:34330 -&gt; IP2:5672):
2023-06-05 21:23:36.319611+00:00 [error] &lt;0.1006.0&gt; {bad_header,&lt;&lt;&quot;GET / HT&quot;&gt;&gt;}
</code></pre>
<p>Where am I wrong ?</p>

jos97
<p>There are 2 issues with your manifests:</p>
<ol>
<li><p>Your <code>Service</code> should be pointing to RabbitMQ's port <code>15672</code> for accessing UI as mentioned in this <a href="https://www.rabbitmq.com/management.html" rel="nofollow noreferrer">document</a> instead of <code>5672</code>.</p>
</li>
<li><p>Both <code>Service</code> and <code>StatefulSet</code> should be in same namespace. In your case they are in <code>default</code> and <code>x</code> respectively.</p>
</li>
</ol>
