Amazon web services 到aws eks群集的kubectl身份验证

Amazon web services 到aws eks群集的kubectl身份验证,amazon-web-services,kubernetes,kubectl,amazon-eks,Amazon Web Services,Kubernetes,Kubectl,Amazon Eks,我已经尝试了所有我能在谷歌上找到的解决方案 aws eks --region $AWS_REGION update-kubeconfig --name $EKS_CLUSTER aws-iam-authenticator token -i $EKS_CLUSTER aws eks get-token --cluster-name $EKS_CLUSTER kubectl edit -n kube-system configmap/aws-auth curl -o a

我已经尝试了所有我能在谷歌上找到的解决方案

   aws eks --region $AWS_REGION update-kubeconfig --name $EKS_CLUSTER
   aws-iam-authenticator token -i $EKS_CLUSTER
   aws eks get-token --cluster-name $EKS_CLUSTER
   kubectl edit -n kube-system configmap/aws-auth
   curl -o aws-auth-cm.yaml.tmpl https://amazon-eks.s3.us-west-2.amazonaws.com/cloudformation/2020-08-12/aws-auth-cm.yaml
   cat aws-auth-cm.yaml.tmpl | sed 's\/<ARN of instance role (not instance profile)>\' "$EKS_CLUSTER_NODE_ROLE_ARN/g" > aws-auth-cm.yaml  - rm aws-auth-cm.yaml.tmpl
   kubectl apply -f aws-auth-cm.yaml
   kubectl config set-context $EKS_CLUSTER

我将首先检查aws cli版本。如果不是最新版本,请更新它。接下来,我将检查IAM角色是否设置正确。

我正在运行最新版本,awscli是作为管道构建的一部分安装的谢谢你@zambozo,我已经按照你在回答中链接的步骤进行了操作,但我在yml中的复制/粘贴操作弄糟了。我已经纠正了它,现在它的工作!为了澄清,您需要遵循步骤1和步骤2。在我的例子中,第一步已经完成了,但第二步我还在努力。我很高兴我能帮上忙。我因多次未正确阅读文档而感到痛苦。
$ cat ./k8s/deployment.yaml.tmpl | sed 's/\$ZONE_ID'"/a/g" | kubectl apply -f - 

error: You must be logged in to the server (the server has asked for the client to provide credentials)
ERROR: Job failed: exit code 1