9.2. 创建集群
当使用 ROSA 命令行界面(CLI) rosa 创建集群时,您可以添加可选的 flag -no-cni 来创建没有 CNI 插件的集群。
先决条件
- 您已完成 Red Hat OpenShift Service on AWS 的 AWS 先决条件。
- 您有可用的 AWS 服务配额。
- 您已在 AWS 控制台中启用了 Red Hat OpenShift Service on AWS。
-
您已在安装主机上安装和配置了最新的 ROSA CLI (
rosa)。运行rosa 版本,以查看您当前安装的 ROSA CLI 版本。如果有更新的版本,CLI 提供了下载此升级的链接。 - 已使用 ROSA CLI 登录您的红帽帐户。
- 您已创建了 OIDC 配置。
- 您已确认 AWS Elastic Load Balancing (ELB)服务角色存在于 AWS 帐户中。
流程
您可以使用以下命令之一创建 Red Hat OpenShift Service on AWS 集群。
注意在 AWS 集群上创建 Red Hat OpenShift Service 时,默认的无类别域间路由(CIDR)为
10.0.0.0/16。如果这与 VPC 子网的 CIDR 范围不匹配,请在以下命令中添加--machine-cidr <address_block>。运行以下命令,使用单个初始机器池、公开可用的 API、公开可用的 Ingress 和没有 CNI 插件创建集群:
rosa create cluster --cluster-name=<cluster_name> \ --sts --mode=auto --hosted-cp --operator-roles-prefix <operator-role-prefix> \ --oidc-config-id <ID-of-OIDC-configuration> --subnet-ids=<public-subnet-id>,<private-subnet-id> --no-cni$ rosa create cluster --cluster-name=<cluster_name> \ --sts --mode=auto --hosted-cp --operator-roles-prefix <operator-role-prefix> \ --oidc-config-id <ID-of-OIDC-configuration> --subnet-ids=<public-subnet-id>,<private-subnet-id> --no-cniCopy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令,使用单个初始机器池、私有可用的 API、私有可用的 Ingress 和没有 CNI 插件创建集群:
rosa create cluster --private --cluster-name=<cluster_name> \ --sts --mode=auto --hosted-cp --subnet-ids=<private-subnet-id> --no-cni$ rosa create cluster --private --cluster-name=<cluster_name> \ --sts --mode=auto --hosted-cp --subnet-ids=<private-subnet-id> --no-cniCopy to Clipboard Copied! Toggle word wrap Toggle overflow 如果您使用
OIDC_ID、SUBNET_IDS和OPERATOR_ROLES_PREFIX变量准备您的环境,您可以在不使用 CNI 插件创建集群时继续使用这些变量。例如,运行以下命令:rosa create cluster --hosted-cp --subnet-ids=$SUBNET_IDS --oidc-config-id=$OIDC_ID --cluster-name=<cluster_name> --operator-roles-prefix=$OPERATOR_ROLES_PREFIX --no-cni
$ rosa create cluster --hosted-cp --subnet-ids=$SUBNET_IDS --oidc-config-id=$OIDC_ID --cluster-name=<cluster_name> --operator-roles-prefix=$OPERATOR_ROLES_PREFIX --no-cniCopy to Clipboard Copied! Toggle word wrap Toggle overflow
运行以下命令检查集群的状态:
rosa describe cluster --cluster=<cluster_name>
$ rosa describe cluster --cluster=<cluster_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重要当您第一次在达到
就绪状态后登录到集群时,节点仍会处于未就绪状态,直到您安装自己的 CNI 插件为止。CNI 安装后,节点将变为就绪。在集群安装过程中,输出中会列出以下
State字段更改:-
待定(准备帐户) -
安装(进行中的DNS 设置) -
installing ready注意如果安装失败,或者
State字段在超过 10 分钟后没有变为ready,请检查安装故障排除文档以了解详细信息。如需更多信息,请参阅 故障排除安装。如需联系红帽支持以获取帮助的步骤,请参阅 Red Hat OpenShift Service on AWS 支持。
-
通过观察 Red Hat OpenShift Service on AWS 安装程序日志来跟踪集群创建的进度。要检查日志,请运行以下命令:
rosa logs install --cluster=<cluster_name> --watch
$ rosa logs install --cluster=<cluster_name> --watch1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 可选: 要在安装过程中监视新日志消息,请使用--
watch参数。
9.2.1. 没有 CNI 插件的集群的预期行为 复制链接链接已复制到粘贴板!
虽然 Red Hat OpenShift Service on AWS 集群安装已完成,但在没有 CNI 插件的情况下集群无法运行。由于节点未就绪,工作负载无法部署。例如,Red Hat OpenShift Service on AWS 集群 Web 控制台不可用,因此您必须使用 OpenShift CLI (oc)来登录到集群。另外,其他 OpenShift 组件(如基于 HAProxy 的 Ingress Controller、镜像 registry 和基于 prometheus 的监控堆栈)没有运行。这是预期的行为,直到安装 CNI 供应商为止。