适用于eksctl扩展节点组的AWS IAM策略

问题描述

是否足以让EKSCTL仅访问

{
    "Version": "2012-10-17","Statement": [
        {
            "Effect": "Allow","Action": [
                "autoscaling:DescribeAutoScalingGroups","autoscaling:DescribeAutoScalingInstances","autoscaling:DescribeLaunchConfigurations","autoscaling:DescribeTags","autoscaling:SetDesiredCapacity"
            ],"Resource": "*"
        }
    ]
}

为了eksctl scale nodegroup --cluster cluster_name --nodes-min=1 --nodes-max=2 --nodes=1 nodegroup_name

如何限制该策略仅扩展特定的组或集群?

解决方法

eksctl 在 CloudFormation 堆栈上运行。因此,您的策略应该授予对 cloudformation: 的写访问权限,以及对 autoscaling: 的只读访问权限(我相信后者需要将 ASG 的当前参数与所需的参数进行比较,但需要测试并确认以确保)。

您应该能够在策略的 Resource 中使用通配符来限制对与特定命名模式匹配的 CloudFormation 堆栈的写入访问权限。例如eksctl 创建的堆栈中始终包含集群名称。