`error: You must be logged in to the server (Unauthorized)` from kubectl on EKS after OIDC login.
AdvancedTroubleshootingOIDC & Cloud Authentication
Answer
Likely causes → The IAM role is not mapped into the cluster: no EKS access entry (or aws-auth ConfigMap entry), wrong cluster or region in update-kubeconfig, or the cluster's authentication mode is CONFIG_MAP only and you created access entries.
Diagnose →
aws sts get-caller-identity
aws eks describe-cluster --name shack --query cluster.accessConfig
aws eks list-access-entries --cluster-name shack
Fix →
aws eks create-access-entry --cluster-name shack --principal-arn arn:aws:iam::111122223333:role/gha-deploy-prod
aws eks associate-access-policy --cluster-name shack --principal-arn arn:aws:iam::111122223333:role/gha-deploy-prod \
--policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy \
--access-scope type=namespace,namespaces=shack-prod
Prevent → Manage access entries in Terraform alongside the role.
More on OIDC & Cloud Authentication
`Error: Could not assume role with OIDC: Not authorized to perform sts:AssumeRoleWithWebIdentity`Advanced`Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers`Intermediate`Error: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable`BeginnerOIDC works on `main` but fails on a tag-triggered release workflow.Intermediate`An error occurred (AccessDenied) when calling the AssumeRoleWithWebIdentity operation: Incorrect token audience`Intermediate`No OpenIDConnect provider found in your account for https://token.actions.githubusercontent.com`Beginner