question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(eks): awsAuth methods should account for role path

See original GitHub issue

As described here and IAM role containing a Path won’t work on the aws-auth configmap and the path must be removed.

Currently passing a role that includes a path to any of the awsAuth methods of the cluster object (i.e awsAuth.addMastersRole) will produce a config map that will not allow the role to authenticate.

For example, creating a no-ingress Cloud9 environment and mapping the instance role, fails to authenticate with the default Instance role as it includes a Path by default (/service-role/)

Reproduction Steps

  1. Create a CDK Stack with C9 environment with CONNECT_SSM connection type and an EKS cluster.
  2. Add the Cloud9 role to the awsAuth as master to the EKS cluster.
  3. Log into the Cloud9 instance.
  4. Update kubeconfig using the instance role.
  5. List nodes will fail with authentication error.

What did you expect to happen?

awsAuth interface should strip the path from the role arn when updating the aws-auth configmap, otherwise allow for a method to pass the arn as String. A method with a signature like:

public addMastersRole(role: string, username?: string): void

What actually happened?

Configmap entry created includes the role path (service-role) and there is not way to exclude it:

{"rolearn":"arn:aws:iam::123456789012:role/service-role/AWSCloud9SSMAccessRole","username":"arn:aws:iam::123456789012:role/service-role/AWSCloud9SSMAccessRole","groups":["system:masters"]}

Environment

  • CDK CLI Version : 1.97.0
  • Framework Version:
  • Node.js Version: v14.16.1
  • OS : Any
  • Language (Version): TypeScript–>

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rafaelpereyracommented, May 3, 2021

Worked great, thanks! Finally got Cloud9 to play nice with EKS without manual steps 😃

1reaction
rafaelpereyracommented, May 3, 2021

Nice, I’ll try that. I thought the ARN had to be valid for that method to work (it won’t be due to the missing path). Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling IAM user and role access to your cluster - Amazon EKS
Access to your cluster using AWS Identity and Access Management (IAM); entities is enabled by the AWS IAM Authenticator for Kubernetes , which...
Read more >
Identity and Access Management - EKS Best Practices Guides
While IAM is the preferred way to authenticate users who need access to an EKS cluster, it is possible to use an OIDC...
Read more >
Handling Auth in EKS Clusters: Setting Up Kubernetes User ...
In order to give the users the ability to assume the roles we created above, we must first create 2 IAM assume role...
Read more >
EKS Auth Deep Dive - DEV Community ‍ ‍
EKS allows giving access to other users by adding them in a configmap aws-auth in kube-system namespace. By default, this configmap is empty....
Read more >
Automate IAM Role Mapping on Amazon EKS with Terraform
eksctl has another subcommand, create iamserviceaccount, that will map IAM roles to the Kubernetes service account. This is what allows your workloads to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found