我在使用
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 update-kubeconfig --name <cluster-name> --region <region> --profile <profile-name>
已验证的 IAM 角色和权限:
AdministratorAccess
,因此它应该具有 EKS 操作所需的权限。aws sts get-caller-identity
输出:
{
"UserId": "AIDAVWIBBMAWEDUDUNGE2",
"Account": "391381082156",
"Arn": "arn:aws:iam::391381082156:user/admin"
}
更新了 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
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 ~]$
它可以在云端与同一用户一起工作。
我设法复制了错误!
我相信您已经使用其他一些 AWS 用户创建了 eks 集群。
并且您正在尝试使用管理员用户进行访问,这意味着默认情况下您无法对其进行存档。因为最初 eks 集群所有者可以访问 eks 集群,并且他只能向其他用户授予访问权限。
如果您需要使用管理员用户访问 eks 集群,则意味着
转到 eks 集群控制台 > 单击您的集群 > 访问
然后创建一个访问条目
然后选择您各自的用户并将类型设置为标准,单击下一步 然后选择 amazoneksclusteradminpolicy 和访问范围作为集群,然后按添加策略
现在您可以访问集群了。