1

I have tried every solution I could get my 'google' on

   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

But I get the following error

$ 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
Nick
  • 1,882
  • 11
  • 16
Hamady C.
  • 1,205
  • 11
  • 13

1 Answers1

1

I would start by checking the aws cli version. If it is not a recent version update it. Next I will go over https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html and see if the IAM roles are set properly.

Zambozo
  • 456
  • 4
  • 12
  • I am running the latest version, the awscli is installed as part of the pipeline build – Hamady C. Oct 01 '20 at 10:47
  • Thank you @zambozo, I had followed the steps you linked in your answer but I messed up my copy/paste in my yml. I have corrected it and now it works! Just to clarify, you need to follow step1 and step2. In my case, step1 was already done but I was struggling with the second one. – Hamady C. Oct 01 '20 at 11:27
  • 1
    I am glad I was able to help. I have been bitten by not reading the documentation properly too many times. – Zambozo Oct 02 '20 at 07:34