【问题标题】:Unable to Authenticate with AWS while integrating GitLab with EKS将 GitLab 与 EKS 集成时无法使用 AWS 进行身份验证
【发布时间】:2020-12-18 15:05:59
【问题描述】:

正在尝试将 GitLab 13.3.2 CE(部署在本地服务器上)与 EKS 集成。

First I provided the Account ID, Access Key and Secret Key. (Admin Area -> Settings -> Integrations) Also Enabled EKS Integration.

其次,我使用指定链接中提到的策略在相应账户中创建了一个 IAM 角色。 (https://docs.gitlab.com/ce/user/project/clusters/add_eks_clusters.html) 仔细遵循此链接中提到的所有步骤。

附加到 aws iam 角色的策略,

以下是创建 IAM 角色的步骤,

  1. 已登录 IAM 控制台
  2. 点击左侧菜单中的角色部分。
  3. 选择受信任实体类型作为“另一个 AWS 账户”
  4. 填写账号ID
  5. 提供了 GitLab 项目的 Kubernetes 控制台中提到的外部 ID

Clicked on the Respective Project, Operations -> Kubernetes -> Add Kubernetes Cluster -> Create New Cluster on Amazon EKS

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "autoscaling:CreateAutoScalingGroup",
                "autoscaling:DescribeAutoScalingGroups",
                "autoscaling:DescribeScalingActivities",
                "autoscaling:UpdateAutoScalingGroup",
                "autoscaling:CreateLaunchConfiguration",
                "autoscaling:DescribeLaunchConfigurations",
                "cloudformation:CreateStack",
                "cloudformation:DescribeStacks",
                "ec2:AuthorizeSecurityGroupEgress",
                "ec2:AuthorizeSecurityGroupIngress",
                "ec2:RevokeSecurityGroupEgress",
                "ec2:RevokeSecurityGroupIngress",
                "ec2:CreateSecurityGroup",
                "ec2:createTags",
                "ec2:DescribeImages",
                "ec2:DescribeKeyPairs",
                "ec2:DescribeRegions",
                "ec2:DescribeSecurityGroups",
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcs",
                "eks:CreateCluster",
                "eks:DescribeCluster",
                "iam:AddRoleToInstanceProfile",
                "iam:AttachRolePolicy",
                "iam:CreateRole",
                "iam:CreateInstanceProfile",
                "iam:CreateServiceLinkedRole",
                "iam:GetRole",
                "iam:ListRoles",
                "iam:PassRole",
                "ssm:GetParameters"
            ],
            "Resource": "*"
        }
    ]
}

在此之后,我复制了新创建角色的 ARN,并在我的项目的 Kubernetes 部分中使用了它。 ()

得到这个作为回复Error: Request failed with status code 422

Response after clicking on "Authenticate with AWS"

【问题讨论】:

    标签: amazon-web-services kubernetes gitlab amazon-eks gitlab-ce


    【解决方案1】:

    将此策略附加到在 GitLab 中启用 EKS 时使用了访问密钥和密钥的用户。

    {
        "Version": "2012-10-17",
        "Statement": {
            "Effect": "Allow",
            "Action": "sts:AssumeRole",
            "Resource": "arn:aws:iam::<<account-id>>:role/gitlab-eks-4"
        }
    }
    

    这使用户有权承担 gitlab-eks 角色(该角色已创建,并且在 EKS 集成时已提供其 ARN)

    【讨论】:

      猜你喜欢
      • 2015-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      • 2020-02-14
      • 2018-04-18
      • 1970-01-01
      • 2016-07-03
      相关资源
      最近更新 更多