<p>I have tried every solution I could get my 'google' on</p>
<pre><code>   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\/&lt;ARN of instance role (not instance profile)&gt;\' &quot;$EKS_CLUSTER_NODE_ROLE_ARN/g&quot; &gt; aws-auth-cm.yaml  - rm aws-auth-cm.yaml.tmpl
   kubectl apply -f aws-auth-cm.yaml
   kubectl config set-context $EKS_CLUSTER
</code></pre>
<p>But I get the following error</p>
<pre><code>$ cat ./k8s/deployment.yaml.tmpl | sed 's/\$ZONE_ID'&quot;/a/g&quot; | 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
</code></pre>

Hamady C.
<p>I would start by checking the aws cli version. If it is not a recent version update it. Next I will go over <a href="https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html</a> and see if the IAM roles are set properly.</p>
