Resolving EKS error: You must be logged in to the server (Unauthorized) when calling kubectl:

Does “aws sts get-caller-identity” return the proper account and user ARN for a user that should have access?

Maybe you need to refresh kubeconfig? “aws eks update-kubeconfig –name EKS_CLUSTER_NAME –region EKS_CLUSTER_AWS_REGION”

https://aws.amazon.com/premiumsupport/knowledge-center/eks-api-server-unauthorized-error/