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

Support configuration of Service Account Issuer Discovery #3143

Open
JanKoppe opened this issue Apr 12, 2024 · 1 comment
Open

Support configuration of Service Account Issuer Discovery #3143

JanKoppe opened this issue Apr 12, 2024 · 1 comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. refinement-needed sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management.
Milestone

Comments

@JanKoppe
Copy link

JanKoppe commented Apr 12, 2024

Description of the feature you would like to add / User story

As a Kubernetes cluster administrator using KubeOne
I would like to be able to configure the service account issuer discovery parameters of kube-apiserver
in order to allow workloads to make use of AWS IRSA to authenticate against AWS APIs.

Solution details

In total, users need to be able to adjust the iss value in service account tokens to a user-specified value.

Alternative approaches

I've considered modifying the kube-apiserver manifest after the cluster is up and running. This won't work though as it is a persistent manifest on the disk of the controllers. It will also be overwritten by KubeOne/kubeadm.

I've considered providing a method to pass on free-form arguments to kubeadm, but it was decided against offering something like that in the past (See #3074 (comment))

Use cases

AWS provides IAM roles for service accounts as a defined mechanic to allow workloads in EKS to fetch temporary AWS API credentials with the specific permissions of an IAM role using their service account tokens.

While AWS markets this feature for their own EKS of course, this is actually not specific to EKS. The feature allows in general any verifiable web (openid) identity to assume an IAM role by providing a valid token.

A verifiably web identity in this case can be any OpenID connect identity provider that provides at least the .well-known/openid-configuration endpoint and a JWKS (JSON Web Key Set).

AWS describes the method to setup such an OpenID connect identity provider in this documentation: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html

The complication that we're running into when using KubeOne is that AWS requires that the value of the issuer iss claim in the provided tokens must be of the same hostname that provides the .well-known/openid-configuration endpoint.

Kubernetes allows the configuration of that iss value through the --service-account-issuer flag for kube-apiserver (https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/).

But KubeOne currently does not allow the user to configure this value to be passed on to kubeadm so that the kube-apiserver is configured correctly.

To compare: The Cluster spec of KKP does allow this to be configured, and we've confirmed that this will make clusters in KKP be able to use AWS IRSA. https://docs.kubermatic.com/kubermatic/v2.25/references/crds/#serviceaccountsettings

Additional information

Another complication that should be considered as context, but not part of the problem: The endpoint that is referenced in the iss value needs to be reachable via HTTPS with a valid TLS certificate (i.e. by a CA of AWS' trust store), but KubeOne sets up the kube-apiserver with a self-signed CA. This makes sense as the majority of KubeOne users probably do not have their own intermediate CA that is in AWS' trust store, so the easiest workaround here is to reverse-proxy that part of the kube-apiserver with a valid TLS certificate (e.g. through an application load balancer in AWS, or something like nginx + Let's Encrypt elswhere) which also allows to only expose those two specific URLs (openid-configuration and JWKS) to AWS in case users do not wish to publicly expose the kube-apiserver (which is recommended for production deployments). Having this external and independent from the kube-apiserver generates the need for this to be a user-definable value because KubeOne can't/shouldn't imply this URL from the provided apiserver hosts.

@JanKoppe JanKoppe added kind/feature Categorizes issue or PR as related to a new feature. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. labels Apr 12, 2024
@kron4eg kron4eg added this to the KubeOne 1.9 milestone Apr 15, 2024
@JanKoppe
Copy link
Author

Quick update: This feature makes most sense if you're also able to configure --service-account-jwks-uri. This one can be hacked around on the outside (just replace the .well-known/openid-configuration file with the correct value ;) ) but it's certainly much cleaner to announce a correct JWKS URI from the apiserver itself.

@xmudrii xmudrii added priority/normal Not that urgent, but is important kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API refinement-needed priority/low Not that important. and removed priority/normal Not that urgent, but is important labels Jun 24, 2024
@kron4eg kron4eg removed the priority/low Not that important. label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. refinement-needed sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management.
Projects
None yet
Development

No branches or pull requests

3 participants