OpenShift edge TLS 终止路由不起作用。 CWWKO0801E: 无法初始化 SSL 连接

OpenShift edge TLS termination route does not work. CWWKO0801E: Unable to initialize SSL connection

有人可以帮我解决 Open-Shift 路线吗?

我已经设置了一个带有 Edge TLS 终止的路由,对服务端点 (https://openshift-pmi-dev.apps.vapidly.os.fyre.ibm.com) 的调用导致:

502 Bad Gateway
The server returned an invalid or incomplete response.

来自 pod 的日志有以下错误我使用端点进行 REST 调用

CWWKO0801E: Unable to initialize SSL connection. Unauthorized access was denied or security settings have expired. Exception is javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    at com.ibm.jsse2.c.a(c.java:6)
    at com.ibm.jsse2.as.a(as.java:532)
    at com.ibm.jsse2.as.unwrap(as.java:580)
    at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:5)
    at com.ibm.ws.channel.ssl.internal.SSLConnectionLink.readyInbound(SSLConnectionLink.java:515)

默认直通路由终止有效!,但这不允许我指定基于路径的路由。因此,尝试使用带有边缘 TLS 终止的路由我正在尝试将流量从 /ibm/pmi/service 路由到 apm-pm-api-service,并将 /ibm/pmi 路由到 apm-pm-ui - 使用单个主机名 https://openshift-pmi-dev.apps.vapidly.os.fyre.ibm.com 的服务。

我已将 SSL 证书加载到边缘路由中,自由服务通过 deployment.yaml 中定义的秘密使用相同的证书。

我无法确定此 SSL 相关错误的根本原因,这是来自 wlp liberty 应用程序服务器还是 openshift 路由问题?

有关如何使自由应用程序正常工作的任何建议。

提前感谢您的帮助!

附上 route.yaml

kind: Route
apiVersion: route.openshift.io/v1
metadata:
  name: openshift-pmi-dev
  namespace: default
  selfLink: /apis/route.openshift.io/v1/namespaces/default/routes/openshift-pmi-dev
  uid: 9ba296f6-1611-11ea-a1ab-0a580afe00ab
  resourceVersion: '6819345'
  creationTimestamp: '2019-12-03T21:12:26Z'
  annotations:
    haproxy.router.openshift.io/balance: roundrobin
    haproxy.router.openshift.io/hsts_header: max age=31536000;includeSubDomains;preload
spec:
  host: openshift-pmi-dev.apps.vapidly.os.fyre.ibm.com
  subdomain: ''
  path: /ibm/pmi/service
  to:
    kind: Service
    name: apm-pm-api-service
    weight: 100
  port:
    targetPort: https
  tls:
    termination: edge
    certificate: |
      -----BEGIN CERTIFICATE-----
      <valid cert>
      -----END CERTIFICATE-----
    key: |
      -----BEGIN RSA PRIVATE KEY-----
      <valid cert>
      -----END RSA PRIVATE KEY-----
    caCertificate: |
      -----BEGIN CERTIFICATE-----
      <valid cert>
      -----END CERTIFICATE-----
    insecureEdgeTerminationPolicy: Redirect
  wildcardPolicy: None
status:
  ingress:
    - host: openshift-pmi-dev.apps.vapidly.os.fyre.ibm.com
      routerName: default
      conditions:
        - type: Admitted
          status: 'True'
          lastTransitionTime: '2019-12-03T21:12:26Z'
      wildcardPolicy: None
      routerCanonicalHostname: apps.vapidly.os.fyre.ibm.com

将路由更改为重新加密,导致应用程序不可用 502 错误。请求似乎没有到达服务。

边缘终止意味着将 http(明文)发送到后端服务,但是您的路由不方便将 http 发送到 https 端口。

放弃 port:https 或使用 'reencrypt' 终止而不是 'edge'

更改以下内容后问题已解决:

  • 在 liberty 应用程序上启用 http (server.xml)
  • 公开 docker 文件的 http 端口
  • 在 service.yaml
  • 上启用 http 端口
  • 使用边缘路由上的 http 端口。