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:
- 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>
- Update the above role's trust relationship document and add your Principal like so:
"arn:aws:iam::0123456789123:user/terraform"
- 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"
- 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
- If you got it all done correctly, now you should be able to run:
kubectl get nonodes