Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authenticating into EKS cluster thru OIDC creates an error with kubent #642

Open
kjenney opened this issue Oct 14, 2024 · 1 comment
Open
Labels
bug Something isn't working not-stale

Comments

@kjenney
Copy link

kjenney commented Oct 14, 2024

We're trying to integrate kubent into our automation workflows. We're running GitLab with self-hosted runners that are deployed to an EKS cluster. When we run GItLab jobs within our pipelines the Kubernetes executor pods are using IRSA with OIDC to assume an IAM role into clusters that we manage. We can run kubectl commands without any issue, however when we run kubent it's giving us the following error:

ERR Failed to retrieve data from collector error="list: failed to list: secrets is forbidden: User \"system:serviceaccount:redacted:atlas-redacted-executor\" cannot list resource \"secrets\" in API group \"\" at the cluster scope" name="Helm v3"

NOTE: The serviceaccount name has been redacted for security purposes. When I run kubent with a log-level of debug I also see this same error for every other type of resource - which makes sense seeing as the serviceaccount doesn't have access to this cluster.

The issue is that the identity that we are using to connect to the cluster is not the serviceaccount, but the assumed role.

$kubectl auth whoami | grep Username
Username    admin
Extra: arn                                             [arn:aws:sts::redacted:assumed-role/redacted-iam-role/AWSCLI-Session]

How can we use kubent to autenticate with EKS clusters from a pod running in another EKS cluster?

@dark0dave dark0dave added bug Something isn't working not-stale labels Oct 25, 2024
@mcmarkj
Copy link

mcmarkj commented Nov 4, 2024

Facing this exact same issue but on GKE.

ERR Failed to retrieve data from collector error="list: failed to list: secrets is forbidden: User \"system:serviceaccount:github-actions:gha-rs-no-permission\" cannot list resource \"secrets\" in API group \"\" at the cluster scope" name="Helm v3"

Whereas it has it's own service account with the right permissions:

TTRIBUTE                                VALUE
Username                                 terraform-github-actions@<redacted>.iam.gserviceaccount.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not-stale
Projects
None yet
Development

No branches or pull requests

3 participants