Skip to main content
2 of 2
"kubectl get no" will actually work but "kubectl get nodes" is clearer as an answer

I had this issue after I launched an EKS cluster with Terraform

In order to hack your way into the cluster you will need to:

  1. Use this command to find the user/role used to create the cluster
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=CreateCluster --region <region>
  1. Update the above role's trust relationship document and add your Principal like so:
"arn:aws:iam::0123456789123:user/terraform"
  1. Use aws cli to assume the above user/role with code like this:
aws sts assume-role \
    --role-arn "arn:aws:iam::0123456789123:role/devops" \
    --role-session-name "eks-access-session"
  1. Use the output key secret-key and token like so:
export AWS_ACCESS_KEY_ID=ASxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY="Rsdfdfsfsfsfsfsfsfsdfsf"
export AWS_SESSION_TOKEN="IsafadfafsdafasfasfafsafafVeryLongTokennnnn"
aws eks --region <region> update-kubeconfig --name my-cluster
  1. If done correctly, now you should be able to run:
kubectl get nodes