Locked Out of EKS After Editing aws-auth: How to Get Back In
Locked out of EKS after editing aws-auth? You can usually get back in without kubectl, through the EKS API.
The short version: run aws sts get-caller-identity to see which identity you really are. If it is the role or user that created the cluster, it may still have admin access: build a kubeconfig for it and repair aws-auth. Otherwise, with IAM permission to manage the cluster, switch the authentication mode to API_AND_CONFIG_MAP (a one-way change), create an access entry for an admin role, and associate AmazonEKSClusterAdminPolicy with cluster scope. New entries can take a few seconds to work. Keep the node-role mappings while you repair it, or your nodes drop out too.
aws sts get-caller-identity, then aws eks describe-cluster --name CLUSTER --region REGION --query "cluster.accessConfig". If you can use the original creator role, generate kubeconfig for it and recover legacy aws-auth. Otherwise, if authorized, enable API_AND_CONFIG_MAP and create a STANDARD EKS access entry with an associated access policy for an existing IAM role. Verify kubectl access before editing node mappings or switching to API only.Jake runs a small phone repair shop and has a production Kubernetes cluster supporting its booking application. An administrator left the company; another engineer edited aws-auth and removed what looked like an old IAM role. Now everyone sees Unauthorized, and new compute instances fail to join. Ethan approaches the incident as two separate identity problems: who can authenticate to Kubernetes, and which roles nodes need to bootstrap.
“The cluster is still active,” Jake says, “so why can no one manage it?” Ethan explains that EKS control-plane availability and Kubernetes authorization are different. A healthy control plane cannot rescue an IAM role mapping that no longer exists, but the AWS EKS management API may still let an authorized operator restore access.
What aws-auth did—and why one YAML edit could lock out a team
The legacy aws-auth ConfigMap lives in the kube-system namespace. The EKS IAM authenticator maps AWS IAM role or user identities to Kubernetes usernames and groups. Kubernetes role-based access control (RBAC) then authorizes the operations associated with those groups. The mapping is not itself an IAM policy and is not the same as permitting eks:DescribeCluster.
On legacy clusters it was common to map administrators to system:masters and EC2 node roles to system:bootstrappers and system:nodes. One indentation error, a deleted administrator mapping, or a changed instance-role ARN can lock out your administrators, your workers, or both. A syntactically valid ConfigMap can still be functionally wrong.
kubectl -n kube-system get configmap aws-auth -o yaml
kubectl auth can-i get pods --all-namespaces
kubectl get nodes -o wide
These commands require an already authorized Kubernetes identity. If you are locked out, their failure does not prove that the AWS cluster or API endpoint is down.
Jake: "I'm an admin in the AWS account. Why does kubectl say I'm unauthorized?"
Ethan: "Because the cluster checks the identity your CLI actually uses, and that's not always the one you think. Ask AWS who you are first."
First find out who you really are—not who your AWS profile says you are
aws sts get-caller-identity --profile recovery --region us-east-1
aws configure list --profile recovery
aws eks describe-cluster --name production-eks --region us-east-1 --profile recovery --query "cluster.{status:status,version:version,platformVersion:platformVersion,auth:accessConfig}"
An IAM Identity Center login or assumed role returns an STS ARN such as arn:aws:sts::111122223333:assumed-role/EKSRecoveryAdmin/alex. For an access entry, use the corresponding IAM role ARN, arn:aws:iam::111122223333:role/EKSRecoveryAdmin, not the STS session ARN. Role paths matter: prefer reading the canonical ARN with aws iam get-role.
aws iam get-role --role-name EKSRecoveryAdmin --query "Role.Arn" --output text --profile recovery
aws eks update-kubeconfig --name production-eks --region us-east-1 --profile recovery --alias production-recovery
kubectl config current-context
kubectl get namespaces
A successful update-kubeconfig only proves AWS let you fetch connection metadata and write a context; it does not prove your role can authenticate or list Kubernetes objects. Also distinguish 401 Unauthorized, 403 Forbidden, and a network or certificate failure. The corrective action differs.
Jake: “I can see the cluster in the console. Doesn’t that mean I am admin?”
Ethan: “No. EKS console visibility is an AWS IAM permission; seeing Kubernetes resources also needs Kubernetes authorization through an access entry or a legacy mapping.”
Identify the authentication mode before choosing a recovery route
| Mode | Identity sources | Recovery significance |
|---|---|---|
| CONFIG_MAP | Legacy aws-auth plus legacy creator behavior | Use creator identity, or switch to an API-capable mode if IAM permits |
| API_AND_CONFIG_MAP | Both; access entry wins for duplicate principal | Safer migration bridge; preserves remaining legacy mappings |
| API | Access entries only | No aws-auth authentication; entries for all relevant principals/nodes must exist |
Authentication mode changes are one-way toward the EKS API. After enabling access entries you cannot return to a mode that removes that API; after switching to API-only you cannot turn ConfigMap authentication back on. Choose API_AND_CONFIG_MAP for a controlled migration, not an immediate API-only cutover.
aws eks describe-cluster --name production-eks --region us-east-1 --query "cluster.accessConfig.authenticationMode" --output text
aws eks list-access-entries --cluster-name production-eks --region us-east-1
The list-access-entries operation is relevant in API-enabled modes. Lack of permission to call it is not the same as an empty list.
Recover through the original cluster creator when possible
Legacy EKS clusters gave the original creating IAM principal administrative Kubernetes access through a control-plane mapping not visible in aws-auth. That historical identity is a recovery route only if it still exists and can be assumed. It is not an arbitrary new administrator, and it is not necessarily the root user. On newly configured clusters the creator-admin bootstrap setting is configurable, so you cannot assume every creator has permanent admin rights.
Identify the original deployment identity from CloudTrail CreateCluster events, infrastructure-as-code records, or team audit records. If an authorized administrator can assume that role, regenerate kubeconfig under that identity and test access. If your IAM role was deleted and recreated, the replacement is not the same effective identity, even with the same name.
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=CreateCluster --region us-east-1 --max-results 20
aws sts get-caller-identity --profile original-creator
aws eks update-kubeconfig --name production-eks --region us-east-1 --profile original-creator
kubectl get configmap aws-auth -n kube-system -o yaml > aws-auth-backup.yaml
CloudTrail lookup has retention and visibility limits; older cluster creation events may require CloudTrail Lake or exported trail logs. If the creator is permanently unavailable, move to the access-entry route using a properly authorized AWS principal.
Jake: "So if I can still reach the EKS API, I'm not really locked out?"
Ethan: "Right. An access entry is created through the EKS API, not kubectl, so you can grant yourself access again without touching aws-auth."
Emergency recovery with an EKS access entry when kubectl is locked out
An operator needs IAM privileges to update EKS authentication mode, create access entries, and associate an access policy. These are EKS management API operations; they work without an already working kubectl connection. If organizational SCPs, permission boundaries, or IAM policies deny them, ask the authorized AWS administrator to perform the recovery rather than bypassing access controls.
aws eks update-cluster-config --name production-eks --region us-east-1 --access-config authenticationMode=API_AND_CONFIG_MAP
aws eks wait cluster-active --name production-eks --region us-east-1
aws eks create-access-entry --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSRecoveryAdmin --type STANDARD
aws eks associate-access-policy --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSRecoveryAdmin --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy --access-scope type=cluster
If your cluster already supports access entries, omit the authentication mode update. If the entry exists, inspect it rather than blindly recreating it. EKS access entries have eventual consistency; allow a short propagation interval after creating or changing an entry, then retry authorized checks. Reserve cluster-admin for break-glass recovery, and replace with scoped permissions later.
aws eks describe-access-entry --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSRecoveryAdmin
aws eks list-associated-access-policies --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSRecoveryAdmin
aws eks update-kubeconfig --name production-eks --region us-east-1 --profile recovery
kubectl get nodes
kubectl get deployments --all-namespaces
Jake: “Why does the access entry help if aws-auth is broken?”
Ethan: “Because EKS authenticates the IAM role through its own access-entry API before consulting the legacy ConfigMap in the mixed mode. It gives us an independent way back in.”
Restore a clean aws-auth without wiping the node-role mapping
If you must maintain ConfigMap authentication, save the existing object first. Preserve its metadata where appropriate, retain node-role entries, and add administrator mappings as a carefully reviewed patch. Inspect every self-managed node identity before you put a minimal ConfigMap over production. Automatic mapping behavior differs for managed node groups and Fargate profiles.
kubectl -n kube-system get configmap aws-auth -o yaml > aws-auth-before-repair.yaml
kubectl -n kube-system edit configmap aws-auth
kubectl -n kube-system get configmap aws-auth -o yaml
kubectl get nodes -o wide
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-auth
namespace: kube-system
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/EKSSelfManagedNodeRole
username: system:node:{{EC2PrivateDNSName}}
groups:
- system:bootstrappers
- system:nodes
- rolearn: arn:aws:iam::111122223333:role/LegacyEKSAdmin
username: legacy-admin
groups:
- system:masters
That YAML is illustrative, not a complete replacement for your cluster. Include all the existing required entries. Be careful with the literal template braces used for node usernames. A role path that exists in IAM must not be pasted into an aws-auth rolearn; use the IAM role ARN behavior supported by the authenticator or migrate that identity to an access entry.
Why removed node roles make nodes fail to join
Self-managed node groups using legacy ConfigMap authentication need their EC2 instance role mapped to the bootstrapper and node groups. If removed, the instances may start but their kubelet registration fails. Verify your EC2 instance-profile role, the role referenced by aws-auth, and node bootstrap logs separately. Map your role ARN, not the instance-profile ARN.
aws eks describe-nodegroup --cluster-name production-eks --nodegroup-name workers --region us-east-1 --query "nodegroup.{status:status,nodeRole:nodeRole,health:health}"
kubectl get nodes -o wide
kubectl -n kube-system get configmap aws-auth -o yaml
EKS managed node groups and Fargate profiles have service-managed access mappings; in API access mode, self-managed node roles use node-specific access-entry types such as EC2_LINUX. Keep AmazonEKSClusterAdminPolicy off node roles. When migrating, record which entries EKS manages automatically and which you own.
aws eks create-access-entry --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSSelfManagedNodeRole --type EC2_LINUX
Run the preceding command only when your cluster uses access entries and that self-managed node role lacks an entry. Node access entry types cannot simply be converted to STANDARD; create the correct type initially.
Map assumed roles correctly, including IAM Identity Center SSO roles
Kubernetes sees the IAM role whose credentials sign the EKS token, not the human-readable username from an SSO portal. IAM Identity Center permission-set roles often use a path such as aws-reserved/sso.amazonaws.com/.... Legacy aws-auth mapping syntax does not support role paths, creating frequent SSO failures. EKS access entries support role ARNs with their full paths. Use the canonical IAM role ARN, not the STS assumed-role session ARN and not a guessed shortened path.
aws sts get-caller-identity --profile team-admin
aws iam get-role --role-name AWSReservedSSO_AdministratorAccess_EXAMPLE --query "Role.Arn" --output text --profile management
aws eks create-access-entry --cluster-name production-eks --principal-arn arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/us-east-1/AWSReservedSSO_AdministratorAccess_EXAMPLE --type STANDARD --region us-east-1
The SSO ARN above is illustrative; the exact role path differs by Identity Center Region and provisioning. IAM Identity Center can delete and recreate managed roles, changing the underlying principal identity or suffix. Prefer a stable customer-managed IAM role assumed by the SSO principal for critical break-glass access.
Give colleagues read-only access without system:masters
aws eks create-access-entry --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSReadOnly --type STANDARD
aws eks associate-access-policy --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/EKSReadOnly --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy --access-scope type=cluster
AmazonEKSViewPolicy grants viewing of many workloads but not every sensitive object; unlike AmazonEKSAdminViewPolicy, it is not intended as a broadly secret-reading policy. For namespace-specific visibility, scope the association to a namespace. IAM permission to call eks:DescribeCluster is also necessary for some console and kubeconfig flows, separate from Kubernetes access.
Jake: “Could I simply map every employee to system:masters so nobody gets locked out again?”
Ethan: “That trades a recoverability problem for an access-control problem. Keep two reviewed break-glass roles, then use scoped access entries for normal work.”
Give CI a stable cluster identity
A CI runner typically assumes a dedicated IAM role using OIDC federation or another short-lived-credential mechanism. Your role needs AWS permissions for the actions it performs and an EKS access entry plus Kubernetes authorization. Keep CI credentials out of ConfigMaps, and give jobs that deploy to one namespace access to that namespace only.
aws sts get-caller-identity
aws eks create-access-entry --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/ProdDeployCI --type STANDARD
aws eks associate-access-policy --cluster-name production-eks --region us-east-1 --principal-arn arn:aws:iam::111122223333:role/ProdDeployCI --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy --access-scope type=namespace,namespaces=production
The CI example uses a namespace edit policy rather than cluster administrator rights. Depending on the release process, a custom RBAC role may offer better precision, particularly for applications that need only patching Deployments or updating a specific ConfigMap.
Worked recovery: the team admin left and all kubeconfig users see Unauthorized
Consider production-eks in us-east-1. The cluster was created years earlier by an operations role, and administrators were later mapped through aws-auth. During staff offboarding, that mapping was deleted. The team tries kubectl and gets Unauthorized, yet CloudFormation, EC2, and the EKS console all still show resources. Their first attempt to restore the file through kubectl fails because no current identity is authenticated.
Step one: the on-call engineer signs into an approved recovery role, runs aws sts get-caller-identity, and confirms the account, Region, and role. Step two: describe-cluster shows CONFIG_MAP mode. Step three: CloudTrail and Terraform state confirm the original creator role is gone. The engineer has EKS management privileges under the organization’s break-glass process.
Step four: they change to API_AND_CONFIG_MAP, wait for the cluster update, create a STANDARD access entry for EKSRecoveryAdmin, and associate AmazonEKSClusterAdminPolicy at cluster scope. Step five: they create kubeconfig for that actual role and can list namespaces. Step six: they export the original aws-auth file, restore the needed self-managed node mapping, and leave a second independent recovery entry. Step seven: they add ordinary developer and CI entries, verify authorization with each profile, and document the owner of every role.
The final recovery is not measured only by a successful kubectl get pods. They also verify existing nodes remain Ready, fresh nodes join, deployment automation still works, and CloudTrail shows the intended EKS access changes. Only after you have inventoried the legacy identities should you consider moving to API-only mode.
aws eks describe-cluster --name production-eks --region us-east-1 --query "cluster.accessConfig"
aws eks list-access-entries --cluster-name production-eks --region us-east-1
kubectl -n kube-system get configmap aws-auth -o yaml > recovered-aws-auth.yaml
kubectl get nodes
kubectl auth can-i patch deployments --namespace production
Authentication error or authorization error? Read the exact failure
| Symptom | Likely layer | First check |
|---|---|---|
| You must be logged in to the server (Unauthorized) | IAM principal did not authenticate to Kubernetes | STS identity, authentication mode, access entry or aws-auth |
| Forbidden: User cannot list pods | Authenticated but lacks Kubernetes permission | EKS access policy scope or Kubernetes RBAC |
| Could not get token / exec plugin failed | Local credential provider | AWS CLI profile, SSO session, kubeconfig exec |
| i/o timeout or TLS handshake failure | Networking or endpoint settings | Cluster endpoint public/private access and DNS |
| Console cannot view Kubernetes objects | IAM/EKS console plus Kubernetes authorization | Current console role and access policy |
Not every kubectl failure is an aws-auth error. A closed private API endpoint, expired SSO login, wrong kubeconfig context, unsupported API version, or missing AWS CLI credentials can look similar to an administrator under incident pressure.
Understand why the console can list the cluster but not its workloads
The EKS console uses AWS IAM to enumerate clusters and Kubernetes-based authorization to read Kubernetes objects. A person may have AWS permissions for eks:ListClusters and eks:DescribeCluster but no entry or RBAC permission for Kubernetes resources. The message “Your current user or role does not have access to Kubernetes objects” is therefore not evidence that the cluster is stopped. Compare the console’s current IAM principal with sts get-caller-identity under the corresponding profile.
Plan an access-entry migration without locking out nodes or people
Use a staged sequence: inventory aws-auth; inventory access entries; create entries for human administrators and CI; test each principal; migrate self-managed node roles to node-typed entries where needed; confirm node health; only then consider API-only. The mixed API_AND_CONFIG_MAP mode is a useful transition, but a principal already represented by an access entry is governed by that entry rather than its older aws-auth mapping. Duplicate identities can therefore surprise teams during migration.
aws eks list-access-entries --cluster-name production-eks --region us-east-1
aws eks describe-access-entry --cluster-name production-eks --principal-arn arn:aws:iam::111122223333:role/EKSRecoveryAdmin --region us-east-1
aws eks list-associated-access-policies --cluster-name production-eks --principal-arn arn:aws:iam::111122223333:role/EKSRecoveryAdmin --region us-east-1
Treat conversion to API-only as a deployment, with a change window and rollback plan for individual access entries. You cannot reverse the authentication-mode transition itself once API-only is selected; your fallback must instead be an authorized EKS API role capable of creating or repairing entries.
Terraform access entries and drift prevention
Terraform supports managing EKS access entries and EKS access policy associations as declarative resources. Keep provider credentials and Terraform state under controlled access, and ensure Terraform has enough IAM authority to retain the break-glass route. Manage each principal from one Terraform state, and reconcile state before you switch between console edits and automated applies.
resource "aws_eks_access_entry" "read_only" {
cluster_name = aws_eks_cluster.main.name
principal_arn = aws_iam_role.eks_readonly.arn
type = "STANDARD"
}
resource "aws_eks_access_policy_association" "read_only" {
cluster_name = aws_eks_cluster.main.name
principal_arn = aws_eks_access_entry.read_only.principal_arn
policy_arn = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy"
access_scope {
type = "cluster"
}
}
For existing resources, import them into Terraform state before managing them. Review plans carefully because destroying an access entry can immediately remove the only Kubernetes route for an automation identity. EKS cluster access-mode arguments can also be managed through infrastructure as code, but verify every dependency before you promote an irreversible mode change.
Prevention: two break-glass roles, clean IAM paths, and regular drills
Make recovery an operational control rather than one person’s laptop: maintain two separately owned, tightly monitored IAM roles with access entries; log their usage; test credentials and Kubernetes permissions at planned intervals. Map individual developer and CI identities using least privilege. Keep a written inventory of cluster creator history, authentication mode, node-role associations, Terraform state, and IAM Identity Center assumptions.
A recurring access review should ask not merely “does admin work?” but “what happens when your most privileged role is deleted, its SSO assignment disappears, or aws-auth is malformed?” Before any migration, save a copy of the ConfigMap and record exactly how to recover using the EKS API. Include private-endpoint network access in the runbook: a valid identity still needs a reachable control-plane endpoint.
Operational checklist: preserve evidence before making the second change
Capture CloudTrail identity events, the cluster access configuration, CloudFormation/eksctl/Terraform change history, and the last good aws-auth copy. Separate evidence collection from remediation. Assign one operator to make changes, one reviewer to compare intended IAM ARNs and scopes, and one tester to validate both administrator and non-administrator outcomes. Stop making permission changes if you cannot articulate how each change preserves an independent recovery identity.
aws sts get-caller-identity
aws eks describe-cluster --name production-eks --region us-east-1 --query "cluster.accessConfig"
aws eks list-access-entries --cluster-name production-eks --region us-east-1
aws eks list-updates --name production-eks --region us-east-1
Common mistakes when copying sample commands
Many examples online use arn:aws:sts::...:assumed-role/... in create-access-entry, confuse an EC2 instance-profile ARN with its underlying node IAM role, omit --region, or assume the AWS console selected the same role as a terminal profile. Other tutorials recommend switching directly to API-only mode without first checking managed node groups and self-managed node mappings. Each shortcut can create a second incident. Use exact IAM ARNs, prefer explicit AWS profiles, and review the result of every command.
What to do if the creator role and AWS EKS management permissions are both unavailable
There is no magic unauthenticated kubectl command to bypass Kubernetes authentication. Recover through your organization’s authorized account and IAM administrators, IAM Identity Center assignments, or an established incident-access process. If an SCP or permission boundary blocks access-entry APIs, the administrator responsible for that control must update or approve the recovery path. Deleting or recreating the cluster to reset permissions risks all workloads and data; access entries fix it with far less risk.
Final decision tree for EKS lockout response
| Question | If yes | If no |
|---|---|---|
| Can the current principal reach Kubernetes? | Back up aws-auth and repair mappings safely | Check IAM identity and auth mode |
| Can the original creator principal be assumed? | Try creator kubeconfig and restore | Check access-entry mode and authorized AWS API recovery |
| Does cluster support access entries? | Create correct STANDARD entry plus policy | Upgrade eligible platform or use legacy authorized recovery |
| Are nodes joining? | Proceed to application RBAC tests | Repair node role mapping/type and networking |
| Are human and CI roles verified? | Document state and consider migration | Do not switch to API-only |
Use a repeatable verification matrix after recovery
A successful response from kubectl under the emergency administrator is only the beginning. Build a short validation matrix that names the expected principal, the expected Kubernetes operation, and the intended result. For example, EKSRecoveryAdmin should read cluster namespaces and list nodes; EKSReadOnly should list deployments without patching them; ProdDeployCI should patch a deployment in production but not in kube-system; the node instance role should register workers rather than act as a human Kubernetes administrator. Execute tests using independently assumed credentials for each role.
The easiest error in this stage is to keep the same active AWS_PROFILE and think the test uses a new role. Run STS before each test. Explicitly set AWS_PROFILE when updating kubeconfig, or use separate KUBECONFIG files for distinct roles. In an IAM Identity Center session, reauthenticate if the session expired and verify the actual assumed role. For EKS access entries, distinguish a missing access policy association from a missing entry: creating the STANDARD entry by itself establishes a recognized identity but might not give it rights to inspect any workload.
AWS_PROFILE=recovery aws sts get-caller-identity
AWS_PROFILE=recovery aws eks update-kubeconfig --name production-eks --region us-east-1 --kubeconfig ./kubeconfig-recovery
KUBECONFIG=./kubeconfig-recovery AWS_PROFILE=recovery kubectl get nodes
KUBECONFIG=./kubeconfig-recovery AWS_PROFILE=recovery kubectl auth can-i list pods --all-namespaces
For each human role, include negative tests. If your read-only user can list deployments but also delete a namespace, you have overprivileged them. EKS access policies and Kubernetes RBAC permissions are generally additive; granting a narrow EKS view policy does not cancel a separate powerful ClusterRoleBinding. If a user retains too much access, inspect all of their memberships and mappings rather than trying to add a deny policy, which EKS access entries cannot express.
IAM permission checklist for access-entry operators
The person repairing a cluster needs authorization for several AWS API calls, not merely permission to run kubectl. Review eks:DescribeCluster, eks:UpdateClusterConfig, eks:ListAccessEntries, eks:DescribeAccessEntry, eks:CreateAccessEntry, eks:AssociateAccessPolicy, and eks:ListAssociatedAccessPolicies. Other read or delete APIs may be appropriate for lifecycle management. In many organizations, an SCP or IAM permission boundary still restricts an otherwise administrator-looking role. Read the actual AccessDenied response before changing a policy.
An access policy association such as AmazonEKSClusterAdminPolicy is a Kubernetes authorization grant mediated by EKS; it is not the same as IAM AdministratorAccess in the AWS account. Conversely, an IAM role with broad AWS permissions does not automatically have all Kubernetes permissions. Confusing these systems is one reason console operators can create and update an EKS cluster but cannot list its Pods. For routine use, keep your infrastructure-administrator role separate from your application-deployment role.
Limit who can create access entries, so no identity can grant itself cluster-admin. Control the EKS management APIs with IAM conditions and approved role boundaries where possible, audit access-entry operations in CloudTrail, and limit the emergency escalation route to authorized operators. Access is a lifecycle: onboarding, temporary elevation, testing, offboarding, and monitoring matter as much as the initial command.
Deleting and recreating an IAM role can invalidate an existing entry
An EKS access entry is associated with a specific IAM principal, not merely an indefinitely reusable text label. EKS stores the underlying IAM user or role identity and may not treat a deleted-and-recreated role with the same ARN string as the same principal. If you recreate a role and hit an unexpected authentication failure, compare role history, review the entry, and recreate the access entry for the replacement role through authorized procedures. Reassess its policies and intended Kubernetes groups before regranting privileges.
A similar problem affects Identity Center-generated AWSReservedSSO roles. Removing the last Identity Center assignment to a permission set may cause its account role to disappear. Re-provisioning later can produce a new role identifier or ARN suffix. If your EKS cluster authorizes that exact reserved role, future users can lose access unexpectedly. A customer-managed role with a deliberately stable name and trust relationship for the Identity Center principal provides a more controlled Kubernetes access target.
These details make break-glass testing important. An emergency role is not useful when the only person who could assume it left, the trust policy references a deleted SSO role, or the external IdP group mapping was not synchronized. Rehearse role assumption and a harmless read-only kubectl call, and audit each emergency use.
Preserve the difference between authentication and network reachability
During lockout incidents it is tempting to assume that any kubectl error proves aws-auth is corrupt. A private endpoint that can only be reached inside a VPC will also stop you as a remote administrator, but with a timeout or DNS/connectivity symptom. Use describe-cluster to inspect endpointPublicAccess, endpointPrivateAccess, and publicAccessCidrs. Check your network path before changing IAM, and ensure approved operators can reach the cluster via a VPN, bastion, or network-connected management environment when your private endpoint is enforced.
aws eks describe-cluster --name production-eks --region us-east-1 --query "cluster.resourcesVpcConfig.{public:endpointPublicAccess,private:endpointPrivateAccess,cidrs:publicAccessCidrs}"
aws eks describe-cluster --name production-eks --region us-east-1 --query "cluster.endpoint"
A failed TLS handshake can also point to certificate or proxy handling; a failure obtaining an executable AWS CLI token can point to the local authentication plugin. Diagnose the outermost failure first. The useful distinction is whether the Kubernetes API server received and rejected a caller, or whether no authenticated Kubernetes request reached the server at all. Change the aws-auth content only when the evidence points to a mapping failure.
A safe procedure for repairing an aws-auth YAML syntax error
When an operator with valid access is available, save the actual ConfigMap including its mapRoles and mapUsers values. Copy only intended changes to a reviewed file and validate indentation: mapRoles is a YAML multiline scalar, while the lines beneath it are another YAML list embedded in that scalar. Two kinds of indentation must therefore be correct. Keep special username templates such as {{EC2PrivateDNSName}} intact, keep the existing node entries, and leave tutorial samples out of production ConfigMaps.
Use kubectl apply --dry-run=server against the intended manifest when possible, keeping in mind that generic Kubernetes YAML validation cannot prove IAM-role mappings are semantically correct. Review the diff before applying. Keep one terminal session using a verified creator or access-entry recovery role, and use a separate session to test a normal role after the change. Confirm both current and newly launched nodes register as Ready. A healthy existing worker node alone is not proof that new node authentication will succeed.
kubectl -n kube-system get configmap aws-auth -o yaml > aws-auth-original.yaml
kubectl diff -f aws-auth-reviewed.yaml
kubectl apply --dry-run=server -f aws-auth-reviewed.yaml
kubectl apply -f aws-auth-reviewed.yaml
kubectl get nodes --watch
If the ConfigMap has already disappeared, investigate the cluster authentication mode before recreating it. An API-only cluster does not need aws-auth for IAM-based user access. A mixed-mode or legacy cluster may need the ConfigMap restored for particular unmanaged identities, especially old self-managed nodes. Work from your last known good inventory, not from assumptions about how all EKS deployments bootstrap.
Incident follow-up: remove emergency privileges thoughtfully
Once applications recover, convert temporary access into a documented policy. You may retain a dedicated cluster-admin break-glass entry because that is the control protecting against the next aws-auth mistake; review and remove temporary individual users mapped to system:masters. Audit who can assume the recovery role, who can call eks:AssociateAccessPolicy, whether alerting covers new access entries, and whether the role’s permissions are subject to organizational restrictions.
Record the incident timeline: who changed aws-auth, what Kubernetes and AWS responses appeared, which EKS access mode was active, how recovery access was created, and which CI and node identities were validated. Capture a sanitized version of the corrected ConfigMap, not credential material. Turn these notes into an operations runbook and an automated policy check. The next engineer should know both how to repair access and what not to do during a high-pressure outage.
Build deployments should not quietly overwrite authentication settings during later Terraform applies or Helm operations. Where possible, let one infrastructure repository own EKS access entries and protect changes with code review. For temporary humans, favor time-bound SSO assignments into stable IAM roles. For CI, favor workload OIDC federation and explicit namespace authorization. This reduces the risk that staffing changes recreate the same lockout.
Official references for this guide
- Grant IAM users access to Kubernetes with EKS access entries: recovering access through the EKS API, and the creator entry that is created automatically.
- Change authentication mode to use access entries: the one-way switch to
API_AND_CONFIG_MAPorAPI. - Create access entries: entry types, and why new entries can take several seconds to take effect.
- Migrating existing aws-auth ConfigMap entries to access entries: node roles as
EC2_LINUX, and admins as STANDARD entries withAmazonEKSClusterAdminPolicy.
For readers preparing for an AWS certification
We have been covering AWS certifications alongside our fixes, so here is a short extra for readers studying for one. If you only came for the fix, you already have it; feel free to skip this part.
Exams that test this topic: DevOps Engineer – Professional (DOP-C02) • Security – Specialty (SCS-C03) • CloudOps Engineer – Associate (SOA-C03).
Here are the exam-style questions this topic tends to raise, with the reasoning you need to answer them:
1. A bad edit to the aws-auth ConfigMap locked everyone out of kubectl. Which identity may still get in?
The IAM principal that created the cluster, if it still has cluster-admin access.
2. What replaces aws-auth for granting cluster access in current EKS?
EKS access entries, used with the API or API_AND_CONFIG_MAP authentication mode and access policies such as AmazonEKSClusterAdminPolicy.
3. How do you regain access through the EKS API when aws-auth is broken?
Set the cluster authentication mode to include the API if it does not, then create an access entry for your IAM role and associate AmazonEKSClusterAdminPolicy.
4. Can you switch an EKS cluster's authentication mode from API back to CONFIG_MAP?
No. Changes only go one way, toward API.
5. After an aws-auth edit, the nodes went NotReady. Why?
The mapping for the node IAM role (groups system:bootstrappers and system:nodes) was removed, so the nodes can no longer authenticate.
6. Which command adds an IAM role mapping without hand-editing YAML?
eksctl create iamidentitymapping; on newer clusters, prefer aws eks create-access-entry.
Exam codes and dates change often. Our AWS certification changes page keeps track of what is current.
FAQ: EKS aws-auth lockouts and access-entry recovery
Does aws-auth still work on new EKS clusters?
It works only when the cluster authentication mode includes CONFIG_MAP. The aws-auth ConfigMap is deprecated in favor of access entries; new cluster defaults vary by provisioning method and settings.
How can I recover if aws-auth removed the only admin role?
First identify the caller with STS. Use the original creator role if it remains authorized, or have an IAM-authorized operator enable/access the EKS access-entry API and grant a recovery role.
Does the original cluster creator always have hidden admin rights?
Legacy clusters granted the creator implicit Kubernetes administrator access. Newer clusters can configure bootstrap creator permissions, so verify the creation settings and the actual principal.
Can I revert API authentication mode back to CONFIG_MAP?
No. Once the EKS API authentication mechanism is enabled, you cannot change back to a mode that removes it. Plan migrations accordingly.
How do I give a colleague read-only access?
Create a STANDARD access entry for the colleague’s IAM role, then associate AmazonEKSViewPolicy at the cluster or desired namespace scope.
Why does the EKS console say my role cannot access Kubernetes objects?
Your AWS IAM role can describe the EKS cluster but lacks a Kubernetes access entry, an effective legacy mapping, or enough Kubernetes authorization.
How do I grant my CI pipeline deployment access?
Create a dedicated assumed IAM role for the pipeline, grant a STANDARD access entry, and scope Kubernetes permissions to the namespace and actions required.
Can Terraform manage EKS access entries?
Yes. Terraform AWS provider supports aws_eks_access_entry and aws_eks_access_policy_association resources. Import existing entries before Terraform takes ownership.
Why do my nodes stop joining after editing aws-auth?
A self-managed node role may have been removed or given the wrong ARN or groups. Restore the required legacy node mapping or create the correct node-typed access entry in API-enabled clusters.
Should I use an IAM user or role in an access entry?
Prefer an IAM role with temporary credentials. It is easier to audit, rotate and grant to a team or CI workload than long-lived IAM user keys.
Why does my SSO role ARN fail in aws-auth?
The legacy ConfigMap role mapping does not support an IAM role path, and IAM Identity Center roles usually contain paths. Use an EKS access entry with the full canonical IAM role ARN.
Is the STS assumed-role ARN the correct access entry principal?
No. Create the entry for the underlying IAM role ARN, not an individual STS assumed-role session ARN.
How do I know whether a 403 means the role is missing?
Authentication succeeded if the API identifies the Kubernetes user but denies an operation. Check authorization scope and RBAC; a 401 usually points earlier in authentication.
Can I safely delete aws-auth after enabling access entries?
Only after every needed human, CI and node identity has been migrated and verified, and the cluster uses API-only authentication. Keep it in a mixed-mode cluster; deleting it is not a shortcut.
What if the old creator role was deleted?
A recreated role does not automatically guarantee the same effective EKS identity. Use an authorized EKS access-entry recovery principal and review historical creator information.
What is the safest permanent fix after a lockout?
Maintain independently managed, audited break-glass IAM roles with EKS access entries, minimize system:masters, test node authentication, and manage ordinary access declaratively.
Closing: fix the mapping, then fix the process
EKS lockout incidents tend to start with a small edit but end with a much larger lesson: cloud IAM authentication, Kubernetes authorization, and node identity are three related but different controls. Restore access with the right IAM principal, use access entries when possible, keep the legacy node configuration intact until migration is proven, and document an independent recovery path. The aim is not merely to make kubectl work once—it is to make the next permission change survivable.
Revision note. Written October 24, 2026; updated November 23, 2026 with exam-style practice questions. "Better safe than sorry," says the proverb; keep a second admin path before you edit cluster access.