title: How do you get kubectl to log in to an AWS EKS cluster?
body: <p>Starting from a ~empty AWS account, I am trying to follow <a href="https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html" rel="noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html</a> </p>
  
  <p>So that meant I created a VPS stack, then installed aws-iam-authenticator, awscli and kubectl, then created an IAM user with Programmatic access and AmazonEKSAdminPolicy directly
  attached.</p>
  
  <p>Then I used the website to create my EKS cluster and used <code>aws configure</code> to set the access key and secret of my IAM user.</p>
  
  <p><code>aws eks update-kubeconfig --name wr-eks-cluster</code> worked fine, but:</p>
  
  <pre><code>kubectl get svc
  error: the server doesn't have a resource type "svc"
  </code></pre>
  
  <p>I continued anyway, creating my worker nodes stack, and now I'm at a dead-end with:</p>
  
  <pre><code>kubectl apply -f aws-auth-cm.yaml
  error: You must be logged in to the server (the server has asked for the client to provide credentials)
  </code></pre>
  
  <p><code>aws-iam-authenticator token -i &lt;my cluster name&gt;</code> seems to work fine.</p>
  
  <p>The thing I seem to be missing is that when you create the cluster you specify an IAM role, but when you create the user (according to the guide) you attach a policy. How is my user supposed to have access to this cluster?</p>
  
  <p>Or ultimately, how do I proceed and gain access to my cluster using kubectl?</p>