AWS – EKS error: You must be logged in to the server (Unauthorized)

It is not well-known information that after creating AWS EKS Cluster the person (user) who created the cluster must give rights to other persons to use kubectl. If the person is not available you will not be able to login to Kubernetes Cluster. We can try to create the same user again and try to move permission to another user.

 

So it the important to move the permission to the next person, just after creating the EKS cluster:

eksctl create iamidentitymapping –cluster clustername –arn arn:aws:iam::XXXXXX:user/destination_user_name –group system:masters –username destination_user_name

 

The eksctl is a parser for kubectl.

Or the best option can always use the DevOps process for creating not only EKS but all resources.

When EKS was created using role you can try one of four scenarios:

https://stackoverflow.com/questions/50791303/kubectl-error-you-must-be-logged-in-to-the-server-unauthorized-when-accessing