AWS EKS:错误:您必须登录到服务器(服务器已要求客户端提供凭证)

问题描述 投票:0回答:1

我在使用

kubectl
访问我的 AWS EKS 集群时遇到问题。我不断遇到以下错误:

E1017 14:53:35.073272   19400 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E1017 14:53:37.144898   19400 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E1017 14:53:39.207462   19400 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E1017 14:53:41.371698   19400 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
E1017 14:53:43.469213   19400 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)

背景:

我使用 eksctl 使用以下命令创建了我的 EKS 集群:

eksctl create cluster --name <cluster-name> --region us-east-1
  • 我有一个 AWS 账户并成功创建了 EKS 集群。
  • 我正在使用附加了 AdministratorAccess 策略的 admin 用户
  • 我已运行以下命令来更新我的 kubeconfig:
aws eks update-kubeconfig --name <cluster-name> --region <region> --profile <profile-name>

我已采取的步骤:

  1. 已验证的 IAM 角色和权限:

    • 我的管理员用户拥有
      AdministratorAccess
      ,因此它应该具有 EKS 操作所需的权限。
    • 我通过运行确认用户已正确设置:
    aws sts get-caller-identity
    

    输出:

    {
        "UserId": "AIDAVWIBBMAWEDUDUNGE2",
        "Account": "391381082156",
        "Arn": "arn:aws:iam::391381082156:user/admin"
    }
    
  2. 更新了 kubeconfig:

    • 运行
      aws eks update-kubeconfig
      命令后,我检查了
      C:\Users\xxx\.kube\config
      处的kubeconfig文件,但当我尝试运行时仍然收到身份验证错误:
    kubectl --kubeconfig C:\Users\x\.kube\config get nodes
    

    输出是:

    E1017 14:49:50.991058   33324 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
    

问题:

  • 如何确保我的管理员用户拥有访问 EKS 集群的适当权限?
  • 我应该采取哪些步骤来修改
    aws-auth
    ConfigMap 以授予访问权限?
  • 我可能缺少任何其他权限或配置吗?

任何有关解决此问题的帮助或指导将不胜感激!谢谢!

无法获取当前服务器 API 组列表:服务器已要求客户端提供凭据错误:您必须登录到服务器

我已经尝试了一切,但我不知道该怎么办

最奇怪的是,

[cloudshell-user@ip-10-136-56-14 ~]$ kubectl get nodes
NAME                            STATUS   ROLES    AGE   VERSION
ip-192-168-22-51.ec2.internal   Ready    <none>   72m   v1.30.4-eks-a737599
ip-192-168-57-66.ec2.internal   Ready    <none>   72m   v1.30.4-eks-a737599
[cloudshell-user@ip-10-136-56-14 ~]$ aws sts get-caller-identity
{
    "UserId": "AIDAVWIBBMAWEDUDUNGE2",
    "Account": "391381082156",
    "Arn": "arn:aws:iam::391381082156:user/admin"
}
[cloudshell-user@ip-10-136-56-14 ~]$ 

它可以在云端与同一用户一起工作。

amazon-web-services amazon-iam amazon-eks eksctl
1个回答
0
投票

我设法复制了错误!

在此输入图片描述

我相信您已经使用其他一些 AWS 用户创建了 eks 集群。

并且您正在尝试使用管理员用户进行访问,这意味着默认情况下您无法对其进行存档。因为最初 eks 集群所有者可以访问 eks 集群,并且他只能向其他用户授予访问权限。

如果您需要使用管理员用户访问 eks 集群,则意味着

转到 eks 集群控制台 > 单击您的集群 > 访问

在此输入图片描述

然后创建一个访问条目

在此输入图片描述

然后选择您各自的用户并将类型设置为标准,单击下一步 然后选择 amazoneksclusteradminpolicy 和访问范围作为集群,然后按添加策略

在此输入图片描述

现在您可以访问集群了。

© www.soinside.com 2019 - 2024. All rights reserved.