Forum Navigation
You need to log in to create posts and topics.

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

Problem

User gets the following error when trying to connect to cluster error: You must be logged in to the server (Unauthorized)”

even after running the following command to update the EKS configuration

aws eks update-kubeconfig –name eks-cluster –region eu-west-1

Solution

Authenticate with AWS CLI and run the following command to get your user configuration

aws sts get-caller-identity

The owner of the EKS Cluster ( the one who created the cluster ) need to add your IAM user or role to aws-auth ConfigMap.

kubectl edit configmap aws-auth –namespace kube-system

Add an IAM user or IAM role, complete one of the following steps.

IAM user

mapUsers: |
– userarn: arn:aws:iam::XXXXXXXXXXXX:user/MYUSERNAME
username: MYUSERNAME
groups:
– system:masters

IAM role

mapRoles: |
– rolearn: arn:aws:iam::XXXXXXXXXXXX:role/MYROLE
username: MYROLE
groups:
– system:masters