第 6 章 在 Red Hat OpenShift Service on AWS 上创建私有集群
对于不需要公共互联网访问的 Red Hat OpenShift Service on AWS 工作负载,您可以创建一个私有集群。
6.1. 使用 ROSA CLI 在 AWS 集群上创建私有 Red Hat OpenShift Service 复制链接链接已复制到粘贴板!
您可以使用 ROSA 命令行界面(CLI)在 AWS 上创建具有多个可用区(Multi-AZ)的私有集群。
先决条件
- 您有可用的 AWS 服务配额。
- 您已在 AWS 控制台中启用了 Red Hat OpenShift Service on AWS。
- 您已在安装主机上安装和配置了 ROSA CLI 的最新版本。
流程
使用托管 control plane 创建集群可能需要大约 10 分钟。
创建带有至少一个专用子网的 VPC。确保您的机器的无类别域间路由(CIDR)与您的虚拟私有云的 CIDR 匹配。如需更多信息,请参阅 使用您自己的 VPC 和 VPC 验证 的要求。
重要如果使用防火墙,您必须进行配置,以便 ROSA 可以访问正常工作所需的站点。
如需更多信息,请参阅"AWS PrivateLink 防火墙先决条件"部分。
运行以下命令来创建集群范围的 IAM 角色:
$ rosa create account-roles --hosted-cp运行以下命令来创建 OIDC 配置:
$ rosa create oidc-config --mode=auto --yes保存 OIDC 配置 ID,因为您需要它来创建 Operator 角色。
输出示例
I: Setting up managed OIDC configuration I: To create Operator Roles for this OIDC Configuration, run the following command and remember to replace <user-defined> with a prefix of your choice: rosa create operator-roles --prefix <user-defined> --oidc-config-id 28s4avcdt2l318r1jbk3ifmimkurk384 If you are going to create a Hosted Control Plane cluster please include '--hosted-cp' I: Creating OIDC provider using 'arn:aws:iam::46545644412:user/user' I: Created OIDC provider with ARN 'arn:aws:iam::46545644412:oidc-provider/oidc.op1.openshiftapps.com/28s4avcdt2l318r1jbk3ifmimkurk384'运行以下命令来创建 Operator 角色:
$ rosa create operator-roles --hosted-cp --prefix <operator_roles_prefix> --oidc-config-id <oidc_config_id> --installer-role-arn arn:aws:iam::$<account_roles_prefix>:role/$<account_roles_prefix>-HCP-ROSA-Installer-Role运行以下命令,在 AWS 集群上创建私有 Red Hat OpenShift Service:
$ rosa create cluster --private --cluster-name=<cluster-name> --sts --mode=auto --hosted-cp --operator-roles-prefix <operator_role_prefix> --oidc-config-id <oidc_config_id> [--machine-cidr=<VPC CIDR>/16] --subnet-ids=<private-subnet-id1>[,<private-subnet-id2>,<private-subnet-id3>]输入以下命令检查集群的状态。在集群创建过程中,输出中的
State字段将从pending转变为安装,最后变为ready。$ rosa describe cluster --cluster=<cluster_name>注意如果安装失败,或者
State字段在 10 分钟后没有变为ready,请参阅附加资源部分中的 "Troubleshooting Red Hat OpenShift Service on AWS installation" 文档。输入以下命令跟踪 OpenShift 安装程序日志以跟踪集群进度:
$ rosa logs install --cluster=<cluster_name> --watch