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.6.10.15. 在 GCP 中创建 control plane 机器
您必须在 Google Cloud Platform (GCP) 中创建 control plane 机器,供您的集群使用。创建这些机器的一种方法是修改提供的 Deployment Manager 模板。
如果不使用提供的 Deployment Manager 模板来创建 control plane 机器,您必须检查提供的信息并手动创建基础架构。如果集群没有正确初始化,您可能需要联系红帽支持并提供您的安装日志。
先决条件
- 配置 GCP 帐户。
- 为集群生成 Ignition 配置文件。
- 在 GCP 中创建和配置 VPC 及相关子网。
- 在 GCP 中创建和配置联网及负载均衡器。
- 创建 control plane 和计算角色。
- 创建 bootstrap 机器。
流程
-
复制 control plane 机器的 Deployment Manager 模板一节中的模板,并将它以
05_control_plane.py
形式保存到计算机上。此模板描述了集群所需的 control plane 机器。 导出资源定义所需的以下变量:
export MASTER_IGNITION=`cat <installation_directory>/master.ign`
$ export MASTER_IGNITION=`cat <installation_directory>/master.ign`
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建
05_control_plane.yaml
资源定义文件:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
infra_id
是来自于提取步骤的INFRA_ID
基础架构名称。- 2
zones
是 control plane 实例要部署到的区域,如us-central1-a
、us-central1-b
和us-central1-c
。- 3
control_subnet
是控制子网的selfLink
URL。- 4
image
是 RHCOS 镜像的selfLink
URL。- 5
machine_type
是实例的机器类型,如n1-standard-4
。- 6
service_account_email
是创建的 master 服务帐户的电子邮件地址。- 7
ignition
是master.ign
文件的内容。
使用
gcloud
CLI 创建部署:gcloud deployment-manager deployments create ${INFRA_ID}-control-plane --config 05_control_plane.yaml
$ gcloud deployment-manager deployments create ${INFRA_ID}-control-plane --config 05_control_plane.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 由于 Deployment Manager 的限制,模板无法管理负载均衡器成员资格,因此您必须手动添加 control plane 机器。
运行以下命令,将 control plane 机器添加到适当的实例组中:
gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_0}-instance-group --zone=${ZONE_0} --instances=${INFRA_ID}-master-0 gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_1}-instance-group --zone=${ZONE_1} --instances=${INFRA_ID}-master-1 gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_2}-instance-group --zone=${ZONE_2} --instances=${INFRA_ID}-master-2
$ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_0}-instance-group --zone=${ZONE_0} --instances=${INFRA_ID}-master-0 $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_1}-instance-group --zone=${ZONE_1} --instances=${INFRA_ID}-master-1 $ gcloud compute instance-groups unmanaged add-instances ${INFRA_ID}-master-${ZONE_2}-instance-group --zone=${ZONE_2} --instances=${INFRA_ID}-master-2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 对于外部集群,还需要运行以下命令将 control plane 机器添加到目标池中:
gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-master-0 gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_1}" --instances=${INFRA_ID}-master-1 gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_2}" --instances=${INFRA_ID}-master-2
$ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_0}" --instances=${INFRA_ID}-master-0 $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_1}" --instances=${INFRA_ID}-master-1 $ gcloud compute target-pools add-instances ${INFRA_ID}-api-target-pool --instances-zone="${ZONE_2}" --instances=${INFRA_ID}-master-2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.10.15.1. control plane 机器的 Deployment Manager 模板 复制链接链接已复制到粘贴板!
您可以使用以下 Deployment Manager 模板来部署 OpenShift Container Platform 集群所需的control plane 机器:
例 6.17. 05_control_plane.py
Deployment Manager 模板