搜索

4.17. 配置自定义证书

download PDF

OpenShift Container Platform API 和 Web 控制台的公共主机名的自定义服务证书 可以在集群安装过程中部署,并可在清单文件中配置。

注意

为与 publicMasterURL 关联的主机名配置自定义证书,该证书设置为 openshift_master_cluster_public_hostname 参数值。为与 masterURL ( openshift_master_cluster_hostname)关联的主机名使用自定义服务证书会导致 TLS 错误,因为基础架构组件尝试使用内部 masterURL 主机联系主 API。

可使用 openshift_master_named_certificates 集群变量配置证书和密钥文件路径:

openshift_master_named_certificates=[{"certfile": "/path/to/custom1.crt", "keyfile": "/path/to/custom1.key", "cafile": "/path/to/custom-ca1.crt"}]

文件路径对于运行 Ansible 的系统来说必须是本地的。证书会复制到 master 主机,并部署到 /etc/origin/master/named_certificates/ 目录中。

Ansible 检测到证书的 Common NameSubject Alternative Names。在设置 openshift_master_named_certificates 时,可以通过提供 "names" 键来覆盖检测到的名称:

openshift_master_named_certificates=[{"certfile": "/path/to/custom1.crt", "keyfile": "/path/to/custom1.key", "names": ["public-master-host.com"], "cafile": "/path/to/custom-ca1.crt"}]

使用 openshift_master_named_certificates 配置的证书会在 master 上缓存。这意味着每个额外的 Ansible 运行使用不同的证书集合,会导致以前部署的所有证书都保留在 master 主机和 master 配置文件中。

如果要使用提供的值(或无值)覆盖 openshift_master_named_certificates,请指定 openshift_master_overwrite_named_certificates 集群变量:

openshift_master_overwrite_named_certificates=true

如需更完整的示例,请考虑清单文件中的以下集群变量:

openshift_master_cluster_method=native
openshift_master_cluster_hostname=lb-internal.openshift.com
openshift_master_cluster_public_hostname=custom.openshift.com

要覆盖后续 Ansible 运行上的证书,请设置以下参数值:

openshift_master_named_certificates=[{"certfile": "/root/STAR.openshift.com.crt", "keyfile": "/root/STAR.openshift.com.key", "names": ["custom.openshift.com"], "cafile": "/root/ca-file.crt"}]
openshift_master_overwrite_named_certificates=true
重要

cafile 证书在安装过程中或重新部署证书期间导入到 master 上的 ca-bundle.crt 文件中。ca-bundle.crt 文件挂载到在 OpenShift Container Platform 中运行的每个 pod 中。几个 OpenShift Container Platform 组件会在访问 masterPublicURL 端点时自动信任命名的证书。如果在证书参数中省略 cafile 选项,Web 控制台的功能和几个其他组件会减少。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.