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.7.3. 使用 Cloud Credential Operator 工具更新云供应商资源
升级使用 CCO 实用程序 (ccoctl) 配置的 OpenShift Container Platform 集群的过程与在安装过程中创建云供应商资源类似。
默认情况下,ccoctl 在运行命令的目录中创建对象。要在其他目录中创建对象,请使用 --output-dir 标志。此流程使用 <path_to_ccoctl_output_dir> 来引用这个目录。
在 AWS 集群中,一些 ccoctl 命令会发出 AWS API 调用来创建或修改 AWS 资源。您可以使用 --dry-run 标志来避免 API 调用。使用此标志可在本地文件系统中创建 JSON 文件。您可以使用 --cli-input-json 参数查看和修改 JSON 文件,然后使用 AWS CLI 工具应用它们。
先决条件
- 获取您要升级到的版本的 OpenShift Container Platform 发行镜像。
-
从发行镜像中提取并准备
ccoctl二进制文件。
流程
运行以下命令,从 OpenShift Container Platform 发行镜像中提取
CredentialsRequest自定义资源 (CR) 列表:oc adm release extract --credentials-requests \ --cloud=<provider_type> \ --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \ quay.io/<path_to>/ocp-release:<version>
$ oc adm release extract --credentials-requests \ --cloud=<provider_type> \ --to=<path_to_directory_with_list_of_credentials_requests>/credrequests \ quay.io/<path_to>/ocp-release:<version>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 其中:
-
<provider_type>是云供应商的值。有效值为alibabacloud、aws、gcp和ibmcloud。 -
credrequests是存储CredentialsRequest对象列表的目录。如果该目录不存在,此命令就会创建该目录。
-
对于发行镜像中的每个
CredentialsRequestCR,请确保集群中存在与spec.secretRef.namespace字段中的文本匹配的命名空间。此字段是保存凭证配置的生成的 secret 的位置。AWS
CredentialsRequest对象示例Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- 此字段指示需要存在的命名空间来存放生成的 secret。
其他平台的
CredentialsRequestCR 具有与不同平台值类似的格式。对于集群没有在
spec.secretRef.namespace中指定的名称的命名空间的CredentialsRequestCR,请创建命名空间:oc create namespace <component_namespace>
$ oc create namespace <component_namespace>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 通过为您的云供应商运行命令,使用
ccoctl工具处理credrequests目录中的所有CredentialsRequest对象。以下命令处理CredentialsRequest对象:-
Alibaba Cloud:
ccoctl alibabacloud create-ram-users -
Amazon Web Services (AWS):
ccoctl aws create-iam-roles -
Google Cloud Platform (GCP):
ccoctl gcp create-all -
IBM Cloud:
ccoctl ibmcloud create-service-id
重要有关所需参数和特殊注意事项,请参阅云供应商的安装内容中的
ccoctl工具说明。对于每个
CredentialsRequest对象,ccoctl会创建所需的供应商资源和 OpenShift Container Platform 发行镜像中的每个CredentialsRequest对象中定义的权限策略。-
Alibaba Cloud:
将 secret 应用到集群:
ls <path_to_ccoctl_output_dir>/manifests/*-credentials.yaml | xargs -I{} oc apply -f {}$ ls <path_to_ccoctl_output_dir>/manifests/*-credentials.yaml | xargs -I{} oc apply -f {}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
您可以通过查询云供应商来验证是否已创建所需的供应商资源和权限策略。如需更多信息,请参阅有关列出角色或服务帐户的云供应商文档。
后续步骤
-
更新
upgradeable-to注解,以指示集群已准备好升级。