5.5. 从 OpenShift 集群外部配置 HTTPS 连接到 Apicurio Registry
以下流程演示了如何配置 Apicurio Registry 部署,以便为 OpenShift 集群外部的连接公开 HTTPS 边缘终止路由。
前提条件
- 您必须已安装了 Service Registry Operator。
- 阅读用于创建安全路由的 OpenShift 文档。
流程
除了 Service Registry Operator 创建的 HTTP 路由外,还添加第二个 Route。请参见以下示例:
kind: Route apiVersion: route.openshift.io/v1 metadata: [...] labels: app: example-apicurioregistry [...] spec: host: example-apicurioregistry-default.apps.example.com to: kind: Service name: example-apicurioregistry-service-9whd7 weight: 100 port: targetPort: 8080 tls: termination: edge insecureEdgeTerminationPolicy: Redirect wildcardPolicy: None注意确保设置了
insecureEdgeTerminationPolicy: Redirectconfiguration 属性。如果没有指定证书,OpenShift 将使用默认值。您可以使用以下命令生成自定义自签名证书:
openssl genrsa 2048 > host.key && openssl req -new -x509 -nodes -sha256 -days 365 -key host.key -out host.cert
然后,使用 OpenShift CLI 创建路由:
oc create route edge \ --service=example-apicurioregistry-service-9whd7 \ --cert=host.cert --key=host.key \ --hostname=example-apicurioregistry-default.apps.example.com \ --insecure-policy=Redirect \ -n default