英文:
Unable to access RabbitMQ UI
问题
我使用以下清单在Kubernetes中部署了RabbitMQ。
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: "..."
- name: RABBITMQ_DEFAULT_PASS
value: "..."
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: {}
在应用此清单后,我可以看到我的Pod正在运行。但是当我尝试进行端口转发时,我无法访问RabbitMQ UI。我遇到了“内部服务器错误”或“错误的网关”错误。
在Pod的日志中,我可以看到:
Server startup complete; 3 plugins started.
* rabbitmq_prometheus
* rabbitmq_web_dispatch
* rabbitmq_management_agent
In the logs I can see:
2023-06-05 21:23:36.319429+00:00 [info] <0.1006.0> accepting AMQP connection <0.1006.0> (IP1:34330 -> IP2:5672)
2023-06-05 21:23:36.319611+00:00 [error] <0.1006.0> closing AMQP connection <0.1006.0> (IP1:34330 -> IP2:5672):
2023-06-05 21:23:36.319611+00:00 [error] <0.1006.0> {bad_header,<<"GET / HT">>}
我做错了什么?
英文:
I deployed RabbitMQ in Kubernetes with the manifest below.
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: "..."
- name: RABBITMQ_DEFAULT_PASS
value: "..."
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: {}
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'.
In the logs of the pod I can see :
Server startup complete; 3 plugins started.
* rabbitmq_prometheus
* rabbitmq_web_dispatch
* rabbitmq_management_agent
In the logs I can see:
2023-06-05 21:23:36.319429+00:00 [info] <0.1006.0> accepting AMQP connection <0.1006.0> (IP1:34330 -> IP2:5672)
2023-06-05 21:23:36.319611+00:00 [error] <0.1006.0> closing AMQP connection <0.1006.0> (IP1:34330 -> IP2:5672):
2023-06-05 21:23:36.319611+00:00 [error] <0.1006.0> {bad_header,<<"GET / HT">>}
Where am I wrong ?
答案1
得分: 1
有两个问题与您的清单相关:
-
您的
Service
应该指向 RabbitMQ 的端口15672
,以便访问用户界面,如此在此 文档 中所述,而不是5672
。 -
Service
和StatefulSet
都应该在相同的命名空间中。在您的情况下,它们分别位于default
和x
命名空间中。
英文:
There are 2 issues with your manifests:
-
Your
Service
should be pointing to RabbitMQ's port15672
for accessing UI as mentioned in this document instead of5672
. -
Both
Service
andStatefulSet
should be in same namespace. In your case they are indefault
andx
respectively.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论