控制出口流量配置以访问外部 URL
Control Egress Traffic Configuration To Access Outside URL
我正在尝试在我的 Flask 应用程序中访问以下数据库
app.config['MONGO_DBNAME'] = 'pymongo_db'
app.config['MONGO_URI'] = 'mongodb://<dbuser>:<dbpassword>@ds163984.mlab.com:63984/pymongo_db'
但是 istio 阻止了我,所以我创建了一个 ServiceEntry
和一个 VirtualService
。但是,我认为我的配置是错误的,因为它不能正常工作。能以某种方式告诉我我做错了什么吗? https://istio.io/docs/tasks/traffic-management/egress/
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: mlab
spec:
hosts:
- wwww.ds163984.mlab.com
- ds163984.mlab.com
ports:
- number: 443
name: https
protocol: HTTPS
resolution: DNS
location: MESH_EXTERNAL
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: mlab
spec:
hosts:
- wwww.ds163984.mlab.com
- ds163984.mlab.com
tls:
- match:
- port: 443
sni_hosts:
- wwww.ds163984.mlab.com
- ds163984.mlab.com
route:
- destination:
host: ds163984.mlab.com
port:
number: 443
weight: 100
顺便说一句,我发现您的配置至少有几处错误。 ServiceEntry
和 VirtualService
中的端口应该是 mongodb 端口 (63984),而不是 443,并且协议应该是 TLS,而不是 HTTPS。
有一个excellent blog post on various ways to configure access to mongodb. It sounds like this section是你想要做的。
我正在尝试在我的 Flask 应用程序中访问以下数据库
app.config['MONGO_DBNAME'] = 'pymongo_db'
app.config['MONGO_URI'] = 'mongodb://<dbuser>:<dbpassword>@ds163984.mlab.com:63984/pymongo_db'
但是 istio 阻止了我,所以我创建了一个 ServiceEntry
和一个 VirtualService
。但是,我认为我的配置是错误的,因为它不能正常工作。能以某种方式告诉我我做错了什么吗? https://istio.io/docs/tasks/traffic-management/egress/
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: mlab
spec:
hosts:
- wwww.ds163984.mlab.com
- ds163984.mlab.com
ports:
- number: 443
name: https
protocol: HTTPS
resolution: DNS
location: MESH_EXTERNAL
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: mlab
spec:
hosts:
- wwww.ds163984.mlab.com
- ds163984.mlab.com
tls:
- match:
- port: 443
sni_hosts:
- wwww.ds163984.mlab.com
- ds163984.mlab.com
route:
- destination:
host: ds163984.mlab.com
port:
number: 443
weight: 100
顺便说一句,我发现您的配置至少有几处错误。 ServiceEntry
和 VirtualService
中的端口应该是 mongodb 端口 (63984),而不是 443,并且协议应该是 TLS,而不是 HTTPS。
有一个excellent blog post on various ways to configure access to mongodb. It sounds like this section是你想要做的。