kubectl Error: You must be logged in to the server

8/21/2019

I've checked almost all of the answers on here, but nothing has resolved this yet.

When running kubectl, I will consistently get error: You must be logged in to the server (Unauthorized).

I have tried editing the config file via kubectl config --kubeconfig=config view, but I still receive the same error, even when running kubectl edit -n kube-system configmap/aws-auth.

Even when I just try to analyze my clusters and run aws eks list-clusters, I receive a different error An error occurred (UnrecognizedClientException) when calling the ListClusters operation: The security token included in the request is invalid.

I have completely torn down my clusters on EKS and rebuilding them, but I keep encountering these same errors. This is my first time attempting to use AWS EKS, and I've been trying different things for a few days.

I've set my aws configure

λ aws configure
AWS Access Key ID [****************Q]: *****
AWS Secret Access Key [****************5]: *****
Default region name [us-west-2]: us-west-2
Default output format [json]: json

Even when trying to look at the config map, I receive the same error:

λ kubectl describe configmap -n kube-system aws-auth

error: You must be logged in to the server (Unauthorized)
-- CrashBurner
amazon-eks
amazon-web-services
kubernetes

0 Answers