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

docs/proposal: add proposal for kubectl login #29350

Merged

Conversation

ericchiang
Copy link
Contributor

@ericchiang ericchiang commented Jul 21, 2016

This PR updates kubernetes/enhancements#32 and #25758 by adding a proposal for a "kubectl login" command.

It's a bit more involved than the implementation discussed with @deads2k in #25758, by proposing a long term goal for the overall subcommand.

cc @kubernetes/sig-auth @kubernetes/kubectl


This change is Reviewable

@k8s-github-robot k8s-github-robot added kind/design Categorizes issue or PR as related to design. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Jul 21, 2016

## Goals

`kubectl login` attempts to guide the user's experience when configuring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want kubectl login to be the entry point for any user trying to connect to an existing server, not just for setting up the credential. I think you described that a bit following this, but I'd like to open with it.

@deads2k
Copy link
Contributor

deads2k commented Jul 21, 2016

I like the concept. Can you break down the phases you see? For instance, I think auto-discovery of auth providers is a natural phase-2.

@ericchiang
Copy link
Contributor Author

Proposal updated

@ericchiang
Copy link
Contributor Author

cc @robszumski please comment if you have any design points


However `kubectl login` should still be seen as a supplement to, not a
replacement for, `kubectl config` by helping validate any kubeconfig generated
by the latter command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't foresee this being a connection that a typical user would make, unless explicitly told to do so in a blog/guide/doc. Definitely, not a blocker or anything though. Just a nice enhancement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Largely just a debugging mechanism. When you turn on authz, it's hard to tell if a user has misconfigured creds or incorrect access. kubectl login could immediately tell you one or the other.

@k8s-bot
Copy link

k8s-bot commented Aug 1, 2016

Build finished. 3522 tests run, 15 skipped, 0 failed.

@ericchiang
Copy link
Contributor Author

@smarterclayton and @erictune does this version of the proposal look reasonable?


To help `kubectl login` diagnose mis-configured credentials, responses from the
API server to authenticated requests will include the `Authentication-Info`
header as defined in [RFC 7615](https://tools.ietf.org/html/rfc7615). The value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liggitt noteworthy update

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "MUST" or "SHOULD"? I.e. when there's a proxy server doing auth, and it doesn't set this, does login have to tolerate that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SHOULD"? I could see use cases where admins don't actually want you to be able to differentiate between a failed login and an authorization denial.

@erictune
Copy link
Member

erictune commented Aug 4, 2016

I like this.

@erictune
Copy link
Member

erictune commented Aug 4, 2016

@cjcullen your thoughts on how this proposal would relate to gcloud container cluster get-credentials


## Examples

If kubeconfig isn't configured, `kubectl login` will attempt to fully configure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer (but interested in other's opinions) that login also support flags for answering all of the questions below - in general I think it should be possible for a client to script "login" correctly without future changes causing failures. I.e.:

kubectl login -u user -p $PASSWORD

should never prompt the user for server info, because the user is in a non-interactive context. Alternatively, we can say "no, this is something that kubectl config is for" (if it's possible to do all the setup that login will do w.r.t. kerberos or oidc).

Either way, we should call it out here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubectl config already has a lot of these options, so I don't know if we want to replicate effort here as well. For now, I think kubectl login should fail if it needs to prompt and isn't in an interactive session by printing a recommendation to use kubectl config.

I imagine experienced users will still prefer kubectl config with kubectl login only being used for final challenges (like a token exchange or password/username validation).

@smarterclayton
Copy link
Contributor

Few more small comments, everything else looks good.

@erictune
Copy link
Member

erictune commented Aug 4, 2016

lgtm once suggested additions are in.

@ericchiang
Copy link
Contributor Author

ericchiang commented Aug 4, 2016

Small updates and added a small section about non-interactive sessions.

@smarterclayton
Copy link
Contributor

Logged in as "janedoe@gmail.com"
```

Users who wish to switch servers can provide the `--switch-cluster` flag which
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big deal, but perhaps something like --prompt-cluster would be better, you might not end up switching clusters. can discuss further in the impl PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--reprompt, --reprompt-cluster and --reprompt-user? Is "reprompt" a word?

@brendandburns
Copy link
Contributor

Given lgtm from @smarterclayton & @erictune I'm ready to LGTM this.

@liggitt do you want anymore changes before merge?

@brendandburns
Copy link
Contributor

Ok, folks have had enough time, and its just a proposal. LGTM

@brendandburns brendandburns added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. release-note-label-needed labels Aug 11, 2016
@brendandburns
Copy link
Contributor

@k8s-bot unit test this please issue: #30462

@k8s-bot
Copy link

k8s-bot commented Aug 14, 2016

GCE e2e build/test passed for commit 5a89b84.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 573ad7a into kubernetes:master Aug 14, 2016
xingzhou pushed a commit to xingzhou/kubernetes that referenced this pull request Dec 15, 2016
…posal

Automatic merge from submit-queue

docs/proposal: add proposal for kubectl login

This PR updates kubernetes/enhancements#32 and kubernetes#25758 by adding a proposal for a "kubectl login" command.

It's a bit more involved than the implementation discussed with @deads2k in kubernetes#25758, by proposing a long term goal for the overall subcommand.

cc @kubernetes/sig-auth @kubernetes/kubectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Categorizes issue or PR as related to design. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants