This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.4.10.6.4. 创建 Kubernetes 清单和 Ignition 配置文件
由于您必须修改一些集群定义文件并要手动启动集群机器,因此您必须生成 Kubernetes 清单和 Ignition 配置文件,集群需要这两项来创建其机器。
安装配置文件转换为 Kubernetes 清单。清单嵌套到 Ignition 配置文件中,稍后用于创建集群。
-
安装程序生成的 Ignition 配置文件包含在 24 小时后过期的证书,然后在过期时进行续订。如果在更新证书前关闭集群,且集群在 24 小时后重启,集群会自动恢复过期的证书。一个例外情况是,您需要手动批准待处理的
node-bootstrapper
证书签名请求(CSR)来恢复 kubelet 证书。如需更多信息,请参阅从过期的 control plane 证书中恢复的文档。 - 建议您在生成 12 小时后使用 Ignition 配置文件,因为集群安装后 24 小时证书从 16 小时轮转至 22 小时。通过在 12 小时内使用 Ignition 配置文件,您可以避免在安装过程中运行证书更新时避免安装失败。
先决条件
- 已获得 OpenShift Container Platform 安装程序。
-
已创建
install-config.yaml
安装配置文件。
流程
切换到包含安装程序的目录,并为集群生成 Kubernetes 清单:
./openshift-install create manifests --dir <installation_directory>
$ ./openshift-install create manifests --dir <installation_directory>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 对于
<installation_directory>
,请指定含有您创建的install-config.yaml
文件的安装目录。
删除定义 control plane 机器的 Kubernetes 清单文件:
rm -f <installation_directory>/openshift/99_openshift-cluster-api_master-machines-*.yaml
$ rm -f <installation_directory>/openshift/99_openshift-cluster-api_master-machines-*.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 通过删除这些文件,您可以防止集群自动生成 control plane 机器。
删除定义 worker 机器的 Kubernetes 清单文件:
rm -f <installation_directory>/openshift/99_openshift-cluster-api_worker-machineset-*.yaml
$ rm -f <installation_directory>/openshift/99_openshift-cluster-api_worker-machineset-*.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 由于您要自行创建并管理 worker 机器,因此不需要初始化这些机器。
检查
<installation_directory>/manifests/cluster-scheduler-02-config.yml
Kubernetes 清单文件中的mastersSchedulable
参数是否已设置为false
。此设置可防止在 control plane 机器上调度 pod:-
打开
<installation_directory>/manifests/cluster-scheduler-02-config.yml
文件。 -
找到
mastersSchedulable
参数并确保它被设置为false
。 - 保存并退出文件。
-
打开
删除
<installation_directory>/manifests/cluster-dns-02-config.yml
DNS 配置文件中的 privateZone部分
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 完全删除此部分。
配置 VPC 的云供应商。
-
打开
<installation_directory>/manifests/cloud-provider-config.yaml
文件。 -
添加
network-project-id
参数,并将其值设为托管共享 VPC 网络的项目 ID。 -
添加
network-name
参数,,将其值设置为托管 OpenShift Container Platform 集群的共享 VPC 网络的名称。 -
将
subnetwork-name
参数的值替换为托管计算机器的共享 VPC 子网的值。
<installation_directory>/manifests/cloud-provider-config.yaml
的内容类似以下示例:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
打开
如果您部署了不属于私有网络的集群,打开
<installation_directory>/manifests/cluster-ingress-default-ingresscontroller.yaml
文件,将scope
参数的值替换为External
。该文件类似于以下示例:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 要创建 Ignition 配置文件,从包含安装程序的目录运行以下命令:
./openshift-install create ignition-configs --dir <installation_directory>
$ ./openshift-install create ignition-configs --dir <installation_directory>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 对于
<installation_directory>
,请指定相同的安装目录。
该目录中将生成以下文件:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow