【发布时间】:2020-01-06 16:58:13
【问题描述】:
我在 kubernetes 中有一个虚拟服务,定义在以下文件中,
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{ .Chart.Name }}-vs
namespace: istio-system
spec:
hosts:
- {{ .Values.virtualservice.host }}
- {{ .Chart.Name }}.default.svc.cluster.local
gateways:
- {{ .Values.virtualservice.gateway }}
- mesh
http:
- route:
- destination:
host: {{ .Chart.Name }}.default.svc.cluster.local
port:
number: {{ .Values.service.port }}
corsPolicy:
allowOrigin:
- '*'
allowMethods:
- OPTIONS
- GET
- POST
- PUT
- DELETE
allowCredentials: true
allowHeaders:
- '*'
maxAge: "24h"
当我转发到它时,我的实际服务运行良好。这是一个只提供 HTTP 服务的 Java 应用程序。
但是,当我尝试通过上面定义的虚拟服务使用HTTPS 访问它时,它会失败。
静态页面加载正常。但是,如果遇到导致应用程序进入后端并访问另一个服务的东西,我就会失败。
该应用实际上是一个 Zuul 代理,需要打后端服务。
我无法弄清楚如何调试此问题或可能导致此问题的原因。
谢谢
编辑
我注意到一件奇怪的事情。包括 api-gw 在内的所有服务都在监听 8080 端口。它们都是Spring-boot 应用程序。
Fails:
- API-gw 服务、SpringBootApp 和 Docker 容器和 kube 服务 - 8080
- 后端服务、SpringBootApp 、Docker 容器和 kube 服务 - 8080
Succeeds:
- API-gw 服务、SpringBootApp 和 Docker 容器以及 kube 服务 - 11243 [除 8080 之外的任何东西]
- 后端服务、SpringBootApp 、Docker 容器和 kube 服务 - 8080
这是什么原因?
谢谢
【问题讨论】:
-
您能否提供有关 ingressgateway 和您的 springboot pod 上的端口的信息? istioctl proxy-config listeners
, istioctl proxy-config cluster -n istio-system istio-ingressgateway。后端注入了吗? -
当我将 API-gw 的端口更改为 11243 时,
listeners命令输出是这样的。特使是否在一个容器中监听所有这些端口和 IP? [clipped] ``` 地址端口类型 10.51.1.37 11243 HTTP .. 10.0.0.10 53 TCP 10.0.125.210 80 TCP 10.0.0.1 443 TCP 10.0.230.67 443 TCP .. 10.0.8.156 8080 TCP .. 0.0.0.0 9092 TCP 10.0.63.7 8088 TCP 10.0.77.207 8080 TCP 0.0.0.0 8080 TCP 0.0.0.0 80 TCP ```
标签: kubernetes kubernetes-ingress istio