5.15. 在 AWS 上卸载集群

您可以删除部署到 Amazon Web Services (AWS) 的集群。

5.15.1. 删除使用安装程序置备的基础架构的集群

您可以从云中删除使用安装程序置备的基础架构的集群。

注意

卸载后,检查云供应商是否有未正确删除的资源,特别是在用户置备基础架构(UPI)集群中。可能存在安装程序未创建或安装程序无法访问的资源。

先决条件

  • 有用于部署集群的安装程序副本。
  • 有创建集群时安装程序生成的文件。

流程

  1. 在用来安装集群的计算机中包含安装程序的目录中,运行以下命令:

    $ ./openshift-install destroy cluster \
    --dir <installation_directory> --log-level info 1 2
    1
    对于 <installation_directory>,请指定安装文件保存到的目录的路径。
    2
    要查看不同的详情,请指定 warndebugerror,而不是 info
    注意

    您必须为集群指定包含集群定义文件的目录。安装程序需要此目录中的 metadata.json 文件来删除集群。

  1. 可选:删除 <installation_directory> 目录和 OpenShift Container Platform 安装程序。

5.15.2. 使用 Cloud Credential Operator 实用程序删除 AWS 资源

要在通过带有 STS 的手动模式使用 Cloud Credential Operator(CCO)卸载 OpenShift Container Platform 集群后清除资源,您可以使用 CCO 实用程序(ccoctl)删除 ccoctl 在安装过程中创建的 AWS 资源。

先决条件

  • 提取并准备 ccoctl 二进制文件。
  • 通过带有 STS 的手动模式使用 CCO 安装 OpenShift Container Platform 集群。

流程

  • 删除 ccoctl 创建的 AWS 资源:

    $ ccoctl aws delete \
      --name=<name> \ 1
      --region=<aws_region> 2
    1
    <name> 与最初用于创建和标记云资源的名称匹配。
    2
    <aws_region> 是要删除云资源的 AWS 区域。

    输出示例:

    2021/04/08 17:50:41 Identity Provider object .well-known/openid-configuration deleted from the bucket <name>-oidc
    2021/04/08 17:50:42 Identity Provider object keys.json deleted from the bucket <name>-oidc
    2021/04/08 17:50:43 Identity Provider bucket <name>-oidc deleted
    2021/04/08 17:51:05 Policy <name>-openshift-cloud-credential-operator-cloud-credential-o associated with IAM Role <name>-openshift-cloud-credential-operator-cloud-credential-o deleted
    2021/04/08 17:51:05 IAM Role <name>-openshift-cloud-credential-operator-cloud-credential-o deleted
    2021/04/08 17:51:07 Policy <name>-openshift-cluster-csi-drivers-ebs-cloud-credentials associated with IAM Role <name>-openshift-cluster-csi-drivers-ebs-cloud-credentials deleted
    2021/04/08 17:51:07 IAM Role <name>-openshift-cluster-csi-drivers-ebs-cloud-credentials deleted
    2021/04/08 17:51:08 Policy <name>-openshift-image-registry-installer-cloud-credentials associated with IAM Role <name>-openshift-image-registry-installer-cloud-credentials deleted
    2021/04/08 17:51:08 IAM Role <name>-openshift-image-registry-installer-cloud-credentials deleted
    2021/04/08 17:51:09 Policy <name>-openshift-ingress-operator-cloud-credentials associated with IAM Role <name>-openshift-ingress-operator-cloud-credentials deleted
    2021/04/08 17:51:10 IAM Role <name>-openshift-ingress-operator-cloud-credentials deleted
    2021/04/08 17:51:11 Policy <name>-openshift-machine-api-aws-cloud-credentials associated with IAM Role <name>-openshift-machine-api-aws-cloud-credentials deleted
    2021/04/08 17:51:11 IAM Role <name>-openshift-machine-api-aws-cloud-credentials deleted
    2021/04/08 17:51:39 Identity Provider with ARN arn:aws:iam::<aws_account_id>:oidc-provider/<name>-oidc.s3.<aws_region>.amazonaws.com deleted

验证

  • 要验证资源是否已删除,请查询 AWS。如需更多信息,请参阅 AWS 文档。