由于 aws-auth ConfigMap 问题,无法更新 EKS NodeGroup

Cannot update EKS NodeGroup because of aws-auth ConfigMap issues

我们有 运行 几个使用 AWS EKS 的集群。

目前所有集群都已在 1.19 上,但节点组仍 运行 在 1.18 上。 NodeGroups 的最后一次更新是在 12 月,一切正常。 aws-auth ConfigMap 自此时起未被修改。

现在我们要更新它们。如果我们在控制台中单击 Update 或使用以下命令:

aws eks --region <clusterRegion> update-nodegroup-version --cluster-name=<clusterName> --nodegroup-name=<nodeGroupName>

...它失败了:

An error occurred (InvalidRequestException) when calling the UpdateNodegroupVersion operation: Nodegroup health has issues other than [ AsgInstanceLaunchFailures, InstanceLimitExceeded, InsufficientFreeAddresses, ClusterUnreachable ]

查看节点组的详细信息会显示以下消息:

AccessDenied: The aws-auth ConfigMap in your cluster is invalid.

相关的 ConfigMap(我们所有人都可以正常访问它)具有以下内容(从敏感信息中删除):

mapRoles: |
    - groups:
      - system:bootstrappers
      - system:nodes
      rolearn: arn:aws:iam::<accountId>:role/<ourEksClusterNodeRole>
      username: system:node:{{EC2PrivateDNSName}}
    - groups:
      - system:masters
      rolearn: arn:aws:iam::<accountId>:role/AWSReservedSSO_SystemAdministrator_<someRandomString>
      username: {{SessionName}}

原来the proposed way by the AWS documentation to integrate SSO users into the clusters与最新版EKS不兼容

无法计算占位符 {{SessionName}}。所以我不得不这样改变它:

mapRoles: |
    - groups:
      - system:bootstrappers
      - system:nodes
      rolearn: arn:aws:iam::<accountId>:role/<ourEksClusterNodeRole>
      username: system:node:{{EC2PrivateDNSName}}
    - groups:
      - system:masters
      rolearn: arn:aws:iam::<accountId>:role/AWSReservedSSO_SystemAdministrator_<someRandomString>
      username: awssso-system-administrator

这种方法的缺点是我们在日志中丢失了审计信息。

解决这个问题(虽然它真的很奇怪):

  1. 像这样调整 aws-auth ConfigMap。
  2. 稍等片刻。
  3. 触发AMI发布版本升级
  4. 等到完成。
  5. 改回 aws-auth ConfigMap。