How to connect to EKS cluster from cloud 9 instance using kubectl

I have created cluster through AWS console and trying to connect to it from cloud9 using kubectl but I am seeing following error error: You must be logged in to the server (Unauthorized) Details

  1. -I created cluster by logging in as root user

  2. -I turnded off temporary credentials in cloud9 settings

  3. -I configured my root use credentials in cloud9 instance and created profile for the same

  4. -I used following command to set aws eks update-kubeconfig --name my-cluster --region us-east-1 --role-arn arn:aws:iam::XXXXXXXXXXX:role/eksadmin-role --profile user1 Unfortunately I am unable to connect to the cluster can someone please help me in understanding where exactly the issue is

Upvotes: 4

Views: 2996

Answers (1)

Kane
Kane

Reputation: 8172

You can use eksctl to update the kubeconfig like below,

eksctl utils write-kubeconfig --cluster <cluster-name> --authenticator-role-arn <role arn to create the eks cluster>

Also you can directly edit the configmap aws-auth in namespace kube-system to grant the permission to other IAM users/roles to access your cluster. See doc https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html for detail.

Upvotes: 0

Related Questions