我正在尝试在k8s集群中设置部署为pod的Rabbitmq。还通过使用URL在集群中进行了[[设置Nginx入口控制器,以便对服务进行外部访问。
这里是工作配置,通过它我可以访问rabbitmq管理控制台
:apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx-gateway
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
tls:
- hosts:
- ***ABC***.com
secretName: gateway-tls-secret
rules:
- host: ***ABC***.com
http:
paths:
- backend:
serviceName: ie-rabbitmq
servicePort: 15672
path: /
登录Nginx控制器
10.202.3.59 - - [24/Dec/2019:06:59:19 +0000] "GET /api/auth HTTP/2.0" 200 57 "https://***ABC***.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36" 324 0.003 [ie-poc-ie-rabbitmq-15672] [] 10.244.5.235:15672 57 0.003 200 eed95f6d3ee6bddae7a7128b4b500152
10.202.3.59 - - [24/Dec/2019:06:59:19 +0000] "GET /js/tmpl/login.ejs?0.16274381270760774 HTTP/2.0" 200 630 "https://***ABC***.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36" 48 0.001 [ie-poc-ie-rabbitmq-15672] [] 10.244.5.235:15672 630 0.001 200 75c43c0e3e3d8de715c4ffa540a4b0a8
但是。当我将
backend.path
从/rabbit
更改为/
时,服务无法访问
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx-gateway
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
tls:
- hosts:
- ***ABC***.com
secretName: gateway-tls-secret
rules:
- host: ***ABC***.com
http:
paths:
- backend:
serviceName: ie-rabbitmq
servicePort: 15672
path: /rabbit
我看到的是,对于此配置,请求被定向到从Nginx控制器日志
[upstream-default-backend] 10.244.3.84:8080
,但是理想情况下,它应将请求重定向到[ie-poc-ie-rabbitmq-15672] [] 10.244.5.235:15672
,即在请求成功时观察到。10.202.3.59 - - [24/Dec/2019:06:57:15 +0000] "GET /api/auth HTTP/2.0" 404 21 "https://i***ABC***.com/rabbit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36" 57 0.001 [upstream-default-backend] [] 10.244.3.84:8080 21 0.001 404 2a1d6b6abf1b7ff03884f275c4a15c14
10.202.3.59 - - [24/Dec/2019:06:57:15 +0000] "GET /js/tmpl/login.ejs?0.4076380641124395 HTTP/2.0" 404 21 "https://***ABC***.com/rabbit" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36" 47 0.001 [upstream-default-backend] [] 10.244.3.84:8080 21 0.001 404 df534e5e9b2e5aabb9fa6bb272d4b5e9
有人可以我正在尝试在k8s集群中设置部署为Pod的Rabbitmq。还设置了Nginx入口控制器,以通过使用URL对群集中的服务进行外部访问。这是...可以帮助我理解为什么第二个配置不起作用/加载rabbitmq配置的原因吗?]
management.path_prefix = /rabbit
添加到Rabbitmq配置图。这为我解决了这个问题。