×

在无法访问云身份和访问管理 (IAM) API 的环境中,必须在安装集群之前将 Cloud Credential Operator (CCO) 置于手动模式。

在 kube-system 项目中存储管理员级密钥的替代方法

Cloud Credential Operator (CCO) 将云提供商凭据管理为 Kubernetes 自定义资源定义 (CRD)。可以通过为install-config.yaml文件中的credentialsMode参数设置不同的值,来配置 CCO 以适应组织的安全要求。

对于 IBM Cloud®,不支持在集群kube-system项目中存储管理员级凭据密钥;因此,在安装 OpenShift Container Platform 时,必须将 CCO 的credentialsMode参数设置为Manual,并手动管理云凭据。

使用手动模式允许每个集群组件仅拥有其所需的权限,而无需在集群中存储管理员级凭据。如果您的环境无法连接到云提供商公共 IAM 端点,也可以使用此模式。但是,必须为每次升级手动协调新发行版映像的权限。还必须手动为请求凭据的每个组件提供凭据。

配置 Cloud Credential Operator 实用程序

当 Cloud Credential Operator (CCO) 处于手动模式时,要从集群外部创建和管理云凭据,请提取并准备 CCO 实用程序 (ccoctl) 二进制文件。

ccoctl实用程序是一个 Linux 二进制文件,必须在 Linux 环境中运行。

先决条件
  • 您可以访问具有集群管理员访问权限的 OpenShift Container Platform 帐户。

  • 您已安装 OpenShift CLI (oc)。

步骤
  1. 通过运行以下命令设置 OpenShift Container Platform 发行版映像的变量

    $ RELEASE_IMAGE=$(./openshift-install version | awk '/release image/ {print $3}')
  2. 通过运行以下命令从 OpenShift Container Platform 发行版映像中获取 CCO 容器映像

    $ CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' $RELEASE_IMAGE -a ~/.pull-secret)

    确保$RELEASE_IMAGE的架构与您将使用ccoctl工具的环境架构匹配。

  3. 通过运行以下命令从 OpenShift Container Platform 发行版映像中的 CCO 容器映像中提取ccoctl二进制文件

    $ oc image extract $CCO_IMAGE \
      --file="/usr/bin/ccoctl.<rhel_version>" \(1)
      -a ~/.pull-secret
    1 对于<rhel_version>,请指定与主机使用的 Red Hat Enterprise Linux (RHEL) 版本相对应的值。如果未指定值,则默认使用ccoctl.rhel8。以下值为有效值
    • rhel8:对于使用 RHEL 8 的主机,指定此值。

    • rhel9:对于使用 RHEL 9 的主机,指定此值。

  4. 更改权限以使ccoctl可执行,方法是运行以下命令

    $ chmod 775 ccoctl.<rhel_version>
验证
  • 要验证ccoctl是否可以使用,请显示帮助文件。运行命令时,请使用相对文件名,例如

    $ ./ccoctl.rhel9
    示例输出
    OpenShift credentials provisioning tool
    
    Usage:
      ccoctl [command]
    
    Available Commands:
      aws          Manage credentials objects for AWS cloud
      azure        Manage credentials objects for Azure
      gcp          Manage credentials objects for Google cloud
      help         Help about any command
      ibmcloud     Manage credentials objects for {ibm-cloud-title}
      nutanix      Manage credentials objects for Nutanix
    
    Flags:
      -h, --help   help for ccoctl
    
    Use "ccoctl [command] --help" for more information about a command.