Skip to content

EKS Cluster Permissions Issue for IAM User Despite system:masters Group Access

0

Description:

I'm experiencing persistent issues with EKS permissions for an IAM user who has been added to the system:masters group in the aws-auth ConfigMap but continues to receive forbidden errors when attempting basic Kubernetes operations, such as listing nodes.

Setup and Actions Taken: EKS Cluster Setup: The EKS cluster was created with standard configurations using eksctl.

IAM User and Role Configurations:

Created an IAM user (dallasinman) and attached policies for eks:* actions, as well as relevant ec2, sts, and iam permissions to cover cluster operations. Added the user to system:masters in the aws-auth ConfigMap as follows: yaml Copy code mapUsers: |

  • userarn: arn:aws:iam::<account-id>:user/dallasinman username: dallasinman groups:
    • system:masters Verified that kubectl config current-context points to the correct cluster ARN. Troubleshooting Steps:

Confirmed the user has policies including eks:AccessKubernetesApi and eks:DescribeCluster. Attempted to assume roles directly on EC2, and confirmed access for the role linked to cluster creation. Updated kubectl version to eliminate potential CLI-related issues. Despite these configurations, running commands like kubectl get nodes yields Error from server (Forbidden): nodes is forbidden. Question: What additional configurations or permissions might I be missing to enable full cluster access for the user added to system:masters? Additionally, are there any specific EKS or IAM configurations that could override aws-auth settings and prevent the user from accessing cluster resources?

1 Answer
0

The issue you're experiencing with your IAM user (dallasinman) not having proper access to your EKS cluster despite being added to the system:masters group in the aws-auth ConfigMap could be due to several factors. Let's explore some potential causes and solutions:

  1. AWS IAM Authenticator Configuration: The AWS IAM Authenticator may not be permitting the role ARN used in the ConfigMap. Ensure that the role ARN specified in the aws-auth ConfigMap does not include a path. If it does, remove the path before specifying the role ARN.

  2. Access Entry Configuration: Amazon EKS has introduced a new way to manage cluster access called Access Entries. This method is separate from the aws-auth ConfigMap. Check if your cluster is configured to use Access Entries instead of or in addition to the aws-auth ConfigMap. You can create an Access Entry for your IAM user through the EKS console or AWS CLI.

  3. Authentication Mode: Verify the authentication mode of your EKS cluster. It could be set to CONFIG_MAP, API_AND_CONFIG_MAP, or API. If it's set to API or API_AND_CONFIG_MAP, you may need to create an Access Entry for your user.

  4. IAM Permissions: Double-check that your IAM user has the necessary permissions to interact with the EKS cluster. Ensure they have permissions for eks:DescribeCluster and eks:AccessKubernetesApi at a minimum.

  5. kubectl Configuration: Verify that your kubectl is correctly configured to use the right AWS credentials. You can do this by running 'aws sts get-caller-identity' to confirm you're using the correct IAM user.

  6. Cluster Access Policy: Check if there are any cluster-level access policies that might be overriding the permissions set in the aws-auth ConfigMap.

  7. Region Mismatch: Ensure that your AWS CLI and kubectl are configured to use the same region as your EKS cluster.

To resolve this issue:

  1. Create an Access Entry for your IAM user through the EKS console or AWS CLI.
  2. Review and update your cluster's authentication mode if necessary.
  3. Double-check your IAM permissions and ensure they include all necessary EKS-related actions.
  4. Verify your kubectl configuration and AWS credentials.
  5. If the issue persists, you may need to review the cluster's access policies and overall IAM configuration to ensure there are no conflicting settings.

Remember, future releases of Amazon EKS may remove the aws-auth ConfigMap authentication source entirely, relying solely on Access Entries and Access Policies. It's a good practice to start using these new methods for managing cluster access.
Sources
Troubleshooting IAM - Amazon EKS
AWS EKS User Access Within the Cluster | AWS re:Post
AccessPolicy - Amazon EKS
Community | Simplified Amazon EKS Cluster Access Management using EKS APIs and AWS Console

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.