我有一个部署了rabbitmq 的kubernetes 集群。我想以可以在浏览器中访问它的方式公开rabbitmanagment UI。为此,我有一个部署、服务和入口文件:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- image: rabbitmq:3.8.9-management
name: rabbitmq
ports:
- containerPort: 5672
- containerPort: 15672
resources: {}
restartPolicy: Always
服务:
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
spec:
ports:
- name: "5672"
port: 5672
targetPort: 5672
- name: "15672"
port: 15672
targetPort: 15672
selector:
app: rabbitmq
入口文件
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- http:
paths:
- path: /rabbitmq
pathType: Prefix
backend:
service:
name: rabbitmq
port:
number: 15672
当我在浏览器中输入 http://localhost/rabbitmq 时,我收到了这个 nginx 错误:{"error":"Object Not Found","reason":"Not Found"}
但是当我进入其他一些 pod 并输入: curl http://rabbitmq:15672 它得到网站的响应。
我是 kubernetes 的新手,我还没有找到任何相关的解决方案来解决我的问题,如果有人可以帮助我,我将不胜感激!!
谢谢阅读。