-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
idea: Credential plugin for kubectl #3690
Conversation
This isn't really mergeable, but after chatting with Sasha last week I wanted to submit this code just to provide some ideas about UX improvements around Teleport's Kubernetes integration. Presented here is an `ExecCredential` plugin, which our users run in place of `tsh`, providing more transparent Kubernetes integration. I imagine most users today are using `tsh login` to fetch credentials and rewrite their kubeconfig out-of-band. The script provided here flips this model on its head, so that `kubectl` executes `tsh login` and presents credentials without actually modifying the kubeconfig (after it's been bootstrapped). There are three commands here: - `bootstrap`: Used once to inject the appropriate kubeconfig - `logout`: Used to explicitly expire credentials - `creds`: Runs `tsh login` if necessary, outputs credentials Using a plugin like this, users who only need Teleport for Kubernetes access can basically forget that `tsh` exists. There's no longer any need for us to train users on Teleport; the shim creates/rotates credentials as necessary. It also fixes an issue we had with `tsh`, which mangles kubeconfigs that use `ExecCredentials`. My hunch here is that the `client-go` version used by `tsh` is simply old and doesn't support `ExecCredential`s. The change as submitted here is likely inappropriate for most consumers, especially being written in Ruby. We've made quite a few assumptions to suit our environment, and the expiry logic is not entirely sound (thus the `logout` command). That said, I think the basic idea is sound, but there would be some work to rewrite this: integrate into `tsh` and generalize the logic a bit. Some relevant links around the `client-go` credential plugins: - https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins - kubernetes/enhancements#541 - kubernetes/community#1503 - kubernetes/kubernetes#59495
Can one of the admins verify this patch? |
Thanks! @awly can you take a look at what's the best possible way to handle this in the upcoming release? |
may be 5.0? |
Great timing, we were just chatting about this with the team! cc @webvictim @benarent @klizhentas agree, 5.0 seems like a good target. I have several other ideas on improving the k8s UX, we could bundle them all together for 5.0. |
This isn't really mergeable, but after chatting with Sasha last week I wanted to submit this code just to provide some ideas about UX improvements around Teleport's Kubernetes integration. Presented here is an
ExecCredential
plugin, which our users run in place oftsh
, providing more transparent Kubernetes integration.I imagine most users today are using
tsh login
to fetch credentials and rewrite their kubeconfig out-of-band. The script provided here flips this model on its head, so thatkubectl
executestsh login
and presents credentials without actually modifying the kubeconfig (after it's been bootstrapped).There are three commands here:
bootstrap
: Used once to inject the appropriate kubeconfiglogout
: Used to explicitly expire credentialscreds
: Runstsh login
if necessary, outputs credentialsUsing a plugin like this, users who only need Teleport for Kubernetes access can basically forget that
tsh
exists. There's no longer any need for us to train users on Teleport; the shim creates/rotates credentials as necessary.It also fixes an issue we had with
tsh
, which mangles kubeconfigs that useExecCredentials
. My hunch here is that theclient-go
version used bytsh
is simply old and doesn't supportExecCredential
s.The change as submitted here is likely inappropriate for most consumers, especially being written in Ruby. We've made quite a few assumptions to suit our environment, and the expiry logic is not entirely sound (thus the
logout
command).That said, I think the basic idea is sound, but there would be some work to rewrite this: integrate into
tsh
and generalize the logic a bit.Some relevant links around the
client-go
credential plugins: