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

[v15] Bootstrap kubernetes RBACs when running EKS auto discovery #42075

Merged
merged 1 commit into from
May 28, 2024

Conversation

tigrato
Copy link
Contributor

@tigrato tigrato commented May 28, 2024

Backport #41693 to branch/v15

Changelog: Extended Discovery Service to self-bootstrap necessary permissions for Kubernetes Service to interact with the Kubernetes API on behalf of users.

* Bootstrap kubernetes RBACs when running EKS auto discovery

This PR extends the ability of `discovery_service` to self-bootstrap the
required permissions for the `kubernetes_service` to dial and forward
requests to the Kubernetes API on behalf of the users.

When EKS auto-discovery was initially developed, it wasn't possible to
bootstrap the required permissions without having prior access to the
cluster itself. Recently, AWS releases a new API to configure access to
IAM identities. By default, there are just a few predifined permissions
that either don't have the required permissions for
`kubernetes_service` to be operational or are the equivalent of
`cluster-admin` RBAC role.

To bypass it, `discovery_service` temporarily escalates itself to
`cluster-admin` by creating an EKS `AccessEntry` and associates the
policy
`arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy`.

Once access is granted, it creates a Kubernetes RBAC `ClusterRole` and
`ClusterRoleBinding` with the minimal required permissions for
`kubernetes_service` to be operational. These permissions are binded to
`teleport:kube-service:eks`.

Finally, it deletes the previously created `AccessEntry` and creates
another for the target ARN that Kubernetes Service uses.

Fixes #39021

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* handle review comments

* do not exit on failed GetCallerIdentity call

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from gabrielcorado May 28, 2024 19:41
@tigrato tigrato added this pull request to the merge queue May 28, 2024
Merged via the queue into branch/v15 with commit 2304e33 May 28, 2024
35 of 36 checks passed
@tigrato tigrato deleted the tigrato/teleport-discovery-access-entry-v15 branch May 28, 2024 20:08
@camscale camscale mentioned this pull request May 31, 2024
@ghost ghost mentioned this pull request Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants