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

Programatic api for kubectl commands (Depends on #7311) #31173

Closed
pwittrock opened this issue Aug 22, 2016 · 15 comments
Closed

Programatic api for kubectl commands (Depends on #7311) #31173

pwittrock opened this issue Aug 22, 2016 · 15 comments
Assignees
Labels
area/kubectl priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Comments

@pwittrock
Copy link
Member

pwittrock commented Aug 22, 2016

Projects such as helm and dashboard vendor in kubectl. This is a terrible experience kubectl:

  • Only supports go
  • Uses stdout for returning results
  • Uses flags to configure behavior

A quick and dirty solution would be to.

  1. refactor kubectl business logic into libraries: tracked in Refactor kubectl to decouple command framework from business logic #7311
  2. provide programatic access to the kubectl commands via a grpc service run as a sidecar in a kubernetes Pod

Alternatively we could: Move the client logic into the api server so thick client logic is not required. #12143

Pros: This is a better engineering solution.
Cons: This is much more challenging and time consuming.

I propose we knock out the quick and dirty solution while we work towards the longer term goal of moving logic into the api server.

@pwittrock pwittrock added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. area/kubectl team/ux labels Aug 22, 2016
@pwittrock pwittrock added this to the UX Backlog - Stack Ranked milestone Aug 22, 2016
@pwittrock pwittrock changed the title Programatic api for kubectl commands Programatic api for kubectl commands (Depends on #7311) Aug 22, 2016
@pwittrock pwittrock added kubectl/epic-programmatic-access size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 22, 2016
@adohe-zz
Copy link

This should be something we need to do next, but first I will help with business logic refactor before we start this.

@smarterclayton
Copy link
Contributor

How would #2 even work for clients using client certs? Without tokens and impersonation (even with tokens and impersonation) there are definitely some risks there. I guess I'm not horribly opposed to it (I like the idea of having an easy API for running GET), but what guarantees would we give for the API?

@pwittrock
Copy link
Member Author

@smarterclayton My intention for 2. was to provide a sidecar bound to the loopback for applications running in the k8s cluster. If I understand correctly, this should only give access to the applications running in the same Pod, is that correct? I don't think this should be any less secure than running a kubectl proxy sidecar.

@smarterclayton
Copy link
Contributor

Oh, I was imagining a server endpoint that accepted Kube credentials and
invoked the appropriate kubectl command. I.e. something web consoles can
drop into easily (which could just be a shell window into a pod with exec).

On Mon, Aug 22, 2016 at 10:12 PM, Phillip Wittrock <notifications@github.com

wrote:

@smarterclayton https://github.com/smarterclayton My intention for 2.
was to provide a sidecar bound to the loopback for applications running in
the k8s cluster. If I understand correctly, this should only give access to
the applications running in the same Pod, is that correct? I don't think
this should be any less secure than running a kubectl proxy sidecar.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#31173 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_pzJTntgJPtY7KxwGGp1X8wQuPOr8ks5qilcmgaJpZM4JqXlJ
.

@pwittrock
Copy link
Member Author

@smarterclayton Ah yes, I agree we would have to be more security conscious in that case. I think https://github.com/rancher/kubectld provides something along those lines. If we are successful with providing a sidecar we could probably extend (or reuse the majority of the work) to handle usages requiring stricter security.

@adohe-zz
Copy link

I think kubectld give a good example of how to wrap kubectl, but definitely if we could a more elegant way to do this, it would be much convenient for third party tools to use kubectl.

@pwittrock
Copy link
Member Author

@adohe Yes, the kubectld approach to wrapping kubectl is pretty simple. This issue could probably even be worked on in parallel by introducing a reasonable abstraction layer for invoking the kubectl logic. Work on them in whatever order makes the most sense to you.

@smarterclayton
Copy link
Contributor

We'd have to version kubectl pretty finely.

On Tue, Aug 23, 2016 at 11:25 AM, Phillip Wittrock <notifications@github.com

wrote:

@adohe https://github.com/AdoHe Yes, the kubectld approach to wrapping
kubectl is pretty simple. This issue could probably even be worked on in
parallel by introducing a reasonable abstraction layer for invoking the
kubectl logic. Work on them in whatever order makes the most sense to you.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#31173 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_pzZsWt1-pAsGd2t2hH5Fkn0SoYBuks5qixDfgaJpZM4JqXlJ
.

@pwittrock
Copy link
Member Author

@smarterclayton Could you expand upon your comment?

@smarterclayton
Copy link
Contributor

In that changes to kubectl happen pretty often - we try to be backwards
compatible, but it's not perfect, and we don't preserve old behavior in all
cases. We also sometimes change behavior for new function. If we exposed
this via GRPC, I wouldn't want to have to continually evolve the GRPC API
based on kubectl - I'd almost expect it to be generated, and potentially be
incompatible from version to version. If someone wants to lock a version,
they could always lock to a particular kubectl version.

On Tue, Aug 23, 2016 at 5:09 PM, Phillip Wittrock notifications@github.com
wrote:

@smarterclayton https://github.com/smarterclayton Could you expand upon
your comment?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#31173 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABG_p8M0gJmt6hDa1DLbJ1_j4LvOSsDHks5qi2F4gaJpZM4JqXlJ
.

@xiangpengzhao
Copy link
Contributor

/sig cli

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Jun 24, 2017
@k8s-github-robot k8s-github-robot removed the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Jun 24, 2017
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 30, 2017
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jan 29, 2018
@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 29, 2018
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@fabiand
Copy link
Contributor

fabiand commented May 30, 2018

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

No branches or pull requests

9 participants