控制出口流量配置以访问外部URL

时间:2019-01-23 02:37:19

标签: kubernetes istio

我正在尝试在我的烧瓶应用程序中访问以下数据库

app.config['MONGO_DBNAME'] = 'pymongo_db'
app.config['MONGO_URI'] = 'mongodb://<dbuser>:<dbpassword>@ds163984.mlab.com:63984/pymongo_db'

但是istio阻止了我,所以我创建了ServiceEntryVirtualService。但是,我认为我的配置错误,因为它无法正常工作。能以某种方式告诉我我在做什么错吗? 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

1 个答案:

答案 0 :(得分:1)

就目前而言,我认为您的配置至少有几处​​错误。 <form action="" method="post" enctype="multipart/form-data"> Select Image File to Upload: <p><input type="file" name="file"/></p> <p><input type="submit" name="upload" value="Upload"/></p> </form> ServiceEntry中的端口应该是mongodb端口(63984),而不是443,协议应该是TLS,而不是HTTPS。

关于excellent blog post的各种配置访问mongodb的方法。听起来this section是您要尝试做的事情。