【问题标题】:kubectl authentication to aws eks cluster对 aws eks 集群的 kubectl 身份验证
【发布时间】:2020-10-02 23:23:29
【问题描述】:

我已经尝试了所有可以使用“google”的解决方案

   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

但我收到以下错误

$ 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

【问题讨论】:

    标签: amazon-web-services kubernetes kubectl amazon-eks


    【解决方案1】:

    我将从检查 aws cli 版本开始。如果不是最新版本,请更新它。接下来我会检查https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html,看看IAM角色是否设置正确。

    【讨论】:

    • 我正在运行最新版本,awscli 是作为管道构建的一部分安装的
    • 谢谢@zambozo,我已按照您在答案中链接的步骤进行操作,但我在 yml 中弄乱了我的复制/粘贴。我已经纠正了它,现在它可以工作了!为了澄清起见,您需要遵循步骤 1 和步骤 2。就我而言,第 1 步已经完成,但我正在为第 2 步苦苦挣扎。
    • 我很高兴能够提供帮助。我被太多次没有正确阅读文档所困扰。
    猜你喜欢
    • 2019-04-15
    • 2019-11-06
    • 1970-01-01
    • 2021-04-16
    • 2021-12-28
    • 1970-01-01
    • 2022-11-16
    • 2018-06-03
    • 2015-05-23
    相关资源
    最近更新 更多