我正在尝试使用 istio 和 envoy 为需要连接到外部 mongodB 服务器的服务实现服务网格,但由于某些原因,我的服务无法从 istio 代理访问外部 mongodB 服务器
下面是我的服务的网关和虚拟服务配置
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: gtreviews
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 7890
name: http
protocol: GRPC
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- "*"
gateways:
- gtreviews
http:
- match:
- uri:
prefix: "/reviews"
route:
- destination:
port:
number: 8080
host: reviews.istio-system.svc.cluster.local
我添加了出口服务条目,但仍然不起作用
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: external-svc-mongocluster
spec:
hosts:
- xxx.xx.com
ports:
- name: mongo
number: 27017
protocol: tcp
location: MESH_EXTERNAL
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: external-svc-mongocluster
spec:
hosts:
- xxx.xx.com
tcp:
- match:
route:
- destination:
host: xxx.xx.com
port:
number: 27017
weight: 100