11.5. 在 AWS (ROSA) CLI 上安装 Red Hat OpenShift Service,rosa


配置 AWS 帐户后,在 AWS (ROSA) CLI 上安装和配置 Red Hat OpenShift Service,rosa

提示

AWS 安全令牌服务(STS)是推荐的凭证模式,用于在 ROSA (经典)上安装和与集群交互,因为它提供了增强的安全性。

11.5.1. 安装和配置 ROSA CLI

在 AWS (ROSA) CLI ( rosa )上安装和配置 Red Hat OpenShift Service。您还可以安装 OpenShift CLI (oc),并使用 ROSA CLI (rosa)验证所需的 AWS 资源配额是否可用。

前提条件

  • 检查并完成 AWS 的先决条件和 ROSA 策略。
  • 如果还没有 红帽帐户,请创建一个红帽帐户。然后,检查您的电子邮件中的验证链接。您需要这些凭证来安装 ROSA。
  • 配置 AWS 帐户并在 AWS 帐户中启用 ROSA 服务。

流程

  1. 安装 rosa,Red Hat OpenShift Service on AWS 的命令行接口 (CLI)。

    1. 为您的操作系统下载 ROSA CLI 的最新版本
    2. 可选:命名您下载到 rosa 的可执行文件。本文档使用 rosa 参考可执行文件。
    3. 可选:在路径中添加 rosa

      示例

      $ mv rosa /usr/local/bin/rosa

    4. 输入以下命令验证您的安装:

      $ rosa

      输出示例

      Command-line tool for Red Hat OpenShift Service on AWS.
      For further documentation visit https://access.redhat.com/documentation/zh-cn/red_hat_openshift_service_on_aws
      
      Usage:
        rosa [command]
      
      Available Commands:
        completion  Generates completion scripts
        create      Create a resource from stdin
        delete      Delete a specific resource
        describe    Show details of a specific resource
        download    Download necessary tools for using your cluster
        edit        Edit a specific resource
        grant       Grant role to a specific resource
        help        Help about any command
        init        Applies templates to support Red Hat OpenShift Service on AWS
        install     Installs a resource into a cluster
        link        Link a ocm/user role from stdin
        list        List all resources of a specific type
        login       Log in to your Red Hat account
        logout      Log out
        logs        Show installation or uninstallation logs for a cluster
        revoke      Revoke role from a specific resource
        uninstall   Uninstalls a resource from a cluster
        unlink      UnLink a ocm/user role from stdin
        upgrade     Upgrade a resource
        verify      Verify resources are configured correctly for cluster install
        version     Prints the version of the tool
        whoami      Displays user account information
      
      Flags:
            --color string   Surround certain characters with escape sequences to display them in color on the terminal. Allowed options are [auto never always] (default "auto")
            --debug          Enable debug mode.
        -h, --help           help for rosa
      
      Use "rosa [command] --help" for more information about a command.

    5. 可选:为 ROSA CLI 生成命令完成脚本。以下示例为 Linux 机器生成 Bash 完成脚本:

      $ rosa completion bash | sudo tee /etc/bash_completion.d/rosa
    6. 可选:从现有终端中为 ROSA CLI 启用命令完成。以下示例在 Linux 机器上的现有终端中启用 rosa 的 Bash 完成功能:

      $ source /etc/bash_completion.d/rosa
  2. 使用 rosa 登录您的红帽帐户。

    1. 输入以下命令。

      $ rosa login
    2. <my_offline_access_token& gt; 替换为您的令牌。

      输出示例

      To login to your Red Hat account, get an offline access token at https://console.redhat.com/openshift/token/rosa
      ? Copy the token and paste it here: <my-offline-access-token>

      输出持续示例

      I: Logged in as 'rh-rosa-user' on 'https://api.openshift.com'

  3. 输入以下命令验证您的 AWS 帐户是否有必要权限。

    $ rosa verify permissions

    输出示例

    I: Validating SCP policies...
    I: AWS SCP policies ok

    注意

    此命令只验证没有使用 AWS 安全令牌服务(STS)的 ROSA 集群的权限。

  4. 验证 AWS 帐户是否具有在 AWS 集群上部署 Red Hat OpenShift Service 所需的配额。

    $ rosa verify quota --region=us-west-2

    输出示例

    I: Validating AWS quota...
    I: AWS quota ok

    注意

    有时,AWS 配额因区域而异。如果您收到任何错误,请尝试不同的区域。

    如果需要提高配额,进入 AWS 控制台,并为失败的服务请求配额增加。

    权限和配额检查通过后,继续下一步。

  5. 为集群部署准备 AWS 帐户:

    1. 运行以下命令验证您的 Red Hat 和 AWS 凭证是否已正确设置。检查 AWS 帐户 ID、默认区域和 ARN 是否与您所期望的内容匹配。您可以安全地忽略以 OCM 开头的行。

      $ rosa whoami

      输出示例

      AWS Account ID:               000000000000
      AWS Default Region:           us-east-2
      AWS ARN:                      arn:aws:iam::000000000000:user/hello
      OCM API:                      https://api.openshift.com
      OCM Account ID:               1DzGIdIhqEWyt8UUXQhSoWaaaaa
      OCM Account Name:             Your Name
      OCM Account Username:         you@domain.com
      OCM Account Email:            you@domain.com
      OCM Organization ID:          1HopHfA2hcmhup5gCr2uH5aaaaa
      OCM Organization Name:        Red Hat
      OCM Organization External ID: 0000000

    2. 初始化 AWS 帐户。此步骤运行一个 CloudFormation 模板,用于准备 AWS 帐户以进行集群部署和管理。此步骤通常需要 1-2 分钟才能完成。

      $ rosa init

      输出示例

      I: Logged in as 'rh-rosa-user' on 'https://api.openshift.com'
      I: Validating AWS credentials...
      I: AWS credentials are valid!
      I: Validating SCP policies...
      I: AWS SCP policies ok
      I: Validating AWS quota...
      I: AWS quota ok
      I: Ensuring cluster administrator user 'osdCcsAdmin'...
      I: Admin user 'osdCcsAdmin' created successfully!
      I: Verifying whether OpenShift command-line tool is available...
      E: OpenShift command-line tool is not installed.
      Run 'rosa download oc' to download the latest version, then add it to your PATH.

  6. 从 ROSA CLI 安装 OpenShift CLI (oc)。

    1. 输入这个命令下载 oc CLI 的最新版本:

      $ rosa download oc
    2. 下载 oc CLI 后,解压它并将其添加到您的路径中。
    3. 输入这个命令来验证 oc CLI 是否已正确安装:

      $ rosa verify oc

安装 ROSA 后,就可以创建集群。

11.5.2. 后续步骤

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2026 Red Hat
返回顶部