AWS 安装失败:IAM 实例配置文件已存在

AWS install fails: IAM instance profile already exists

我正在使用安装程序配置的基础设施 (IPI) 在我的 AWS 集群上安装 openshift 4.4.9,但未能成功在 AWS 上启动我的 openshift 集群。由于以下错误。

INFO Creating infrastructure resources...
ERROR
ERROR Error: Error creating IAM instance profile ocp4-925gm-bootstrap- 
 profile: EntityAlreadyExists: 
Instance Profile ocp4-925gm-bootstrap-profile already exists.
ERROR   status code: 409, request id: b6918967-774c-44c1-8b92-02ac7388f87c
ERROR
ERROR   on ../../../tmp/openshift-install-584826335/bootstrap/main.tf line 46, in resource 
"aws_iam_instance_profile" "bootstrap":
 ERROR   46: resource "aws_iam_instance_profile" "bootstrap" {

ERROR Error: Error creating IAM instance profile ocp4-925gm-worker-profile: EntityAlreadyExists: 
Instance Profile ocp4-925gm-worker-profile already exists.
ERROR   status code: 409, request id: 3b5d2b9c-28fe-4c95-b622-7a80af45dfb6
ERROR
ERROR   on ../../../tmp/openshift-install-584826335/iam/main.tf line 5, in resource 
 "aws_iam_instance_profile" "worker":
ERROR    5: resource "aws_iam_instance_profile" "worker" {
ERROR Error: Error creating IAM instance profile ocp4-925gm-master-profile: EntityAlreadyExists: 
Instance Profile ocp4-925gm-master-profile already exists.
ERROR   status code: 409, request id: 072d86e1-3508-4d59-a6ab-2ed647251056
ERROR
ERROR   on ../../../tmp/openshift-install-584826335/master/main.tf line 9, in 
resource 
 "aws_iam_instance_profile" "master":
ERROR    9: resource "aws_iam_instance_profile" "master" {
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to 
create cluster: failed 
to apply using Terraform

修复的解决方案

  1. 这种情况建议手动删除。

  2. 列出您的角色,然后将删除应用到实例配置文件。

    $ aws iam list-roles
    $ aws --region=<region-name> iam delete-instance-profile --instance-profile-name <profile_name>
    

下面给出的例子

    $ aws --region=us-east-1 iam delete-instance-profile --instance-profile-name  ocp4-925gm-master-profile

    $ aws --region=us-east-1 iam delete-instance-profile --instance-profile-name  ocp4-925gm-worker-profile

Reference Link