【问题标题】:Unable to reach an external mongo db server from istio无法从 istio 访问外部 mongo db 服务器
【发布时间】:2018-10-17 14:46:10
【问题描述】:

我正在尝试使用 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

【问题讨论】:

    标签: mongodb kubernetes istio envoyproxy


    【解决方案1】:

    尝试将ServiceEntry 中的端口指定为 TLS(名称和协议)。

    我现在正在处理有关 MongoDB 的任务,请查看此 PR https://github.com/istio/istio.io/pull/2347/ 中的“TLS 出口控制”部分,它还有些原始。

    【讨论】:

    • 您确定通过 TLS 连接到您的 MongoDB 吗? docs.mongodb.com/manual/tutorial/configure-ssl
    • 其实我的mongodb服务器不需要任何TLS/SSL证书。我只是使用用户名和密码来连接它。我是 istio 的新手,不确定一切是如何工作的
    • 您可以尝试使用:openssl s_client -connect mymongo.xx.com:27017 -servername mymongo.xx.com,从 Istio 外部和 Istio 内部的 pod 连接到它吗?
    • 实际上,当我使用上述连接时,即使从外部 istio 也遇到握手失败
    • 你没有拿到MongoDB主机的证书?所以它没有配置TLS?在这种情况下,您可以使用 TCP(而非 TLS)出口控制,请参阅istio.io/blog/2018/egress-tcp
    猜你喜欢
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2020-09-16
    • 2021-06-22
    • 1970-01-01
    • 2018-08-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多