【问题标题】:Openshift TLS configuration with API Gateway使用 API 网关的 Openshift TLS 配置
【发布时间】:2021-09-17 05:59:10
【问题描述】:

我正在尝试在 Openshift 上部署一个 Angular 应用程序,并将 Istio 作为服务网格。服务 yaml:

  - apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: angularapp
        service: angularapp
        version: v1
      name: angularapp
    spec:
      ports:
      - name: http
        protocol: TCP
        port: 8080
        targetPort: 8080
      selector:
        name: angularapp

到目前为止,一切都适用于 http 连接。为了更改为 https 连接,我将 Red Hat Openshift Service Mesh operator 安装提供的 istio-ingressgateway 路由配置为使用 passthrough

spec:
  host: istio-ingressgateway-istio-system.apps.xxx.xx.xxxxxxx.opentlc.com
  tls:
    insecureEdgeTerminationPolicy: None
    termination: passthrough

以及 istio 的网关资源:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: testnamespace-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
    - port:
        number: 443
        name: https
        protocol: HTTPS
      tls:
        mode: SIMPLE
        credentialName: "router-certs"
      hosts:
        - "*"

VirtualService 指向 Angular 应用程序的 8080 端口:

      route:
        - destination:
            host: angularapp
            port:
              number: 8080

问题:TLS 配置有效,并且暴露的 istio 入口网关 URL 确实具有 https 连接。但是,API Gateway 在向上述 istio URL 发出请求时会发出此错误:

由于配置错误,执行失败:无法识别的 SSL 消息,明文连接?

奇怪的是它只发生了一半,另一半有效,即使在每次运行后清除浏览器缓存后也是如此。请注意,只有 istio 入口网关 URL 具有 https 连接,而作为独立服务的 Angular 应用程序只有 http。

很抱歉这个冗长的问题,希望在这里得到一些帮助。谢谢!

【问题讨论】:

    标签: kubernetes openshift aws-api-gateway istio


    【解决方案1】:

    通过直通终止,加密流量直接发送到 没有路由器提供 TLS 终止的目的地。 因此不需要密钥或证书。

    因为你的后端服务是 http,你应该在边缘使用终止 SSL

    termination: edge
    

    参考:https://docs.openshift.com/container-platform/3.9/architecture/networking/routes.html

    【讨论】:

    • 嗨 Rakesh,我尝试将 istio 入口网关路由切换到边缘,但我根本无法访问 URL,出现以下错误:{“message”:“网络错误与端点通信"}
    【解决方案2】:

    通过添加段解决了这个问题:

      port:
        targetPort: https
      tls:
        termination: passthrough
    

    到 istio 入口路由配置,因为 istio 入口服务默认配置侦听端口名称:https

    name: https  
    port: 443  
    protocol: TCP  
    targetPort: 8080
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-24
      • 2020-08-15
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 2021-11-14
      • 2021-07-03
      相关资源
      最近更新 更多