-
Notifications
You must be signed in to change notification settings - Fork 42.1k
feat: add support for webassembly for kubectl #133638
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
base: master
Are you sure you want to change the base?
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Aug 21 08:00:27 UTC 2025. |
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Upstream PR for term moby/term#49 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: remyleone The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@remyleone: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/cc @soltysh |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
lmktfy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very intriguing!
If this isn't good to merge as is, let's add a suitable do-not-merge label to the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is the right path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was mostly a demo that I shared around to have something that work. But because the amount of requests performed by kubectl is not clear to trace, I was not able to make all the traffic go though http.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's find a better home for this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's find a better home for this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is not designed to stay here, it was created to be iterated upon quickly. My main blocker at the moment would be how to have requests from kubectl be only http ones and avoid the tcp/udp probe that are not available on webassembly
| if err := conn.Close(); err != nil { | ||
| return nil, err | ||
| } | ||
| fmt.Println("tls config: ", tlsConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think we want to add fmt.Println.
| }, | ||
| } | ||
|
|
||
| conn, err := tls.Dial("tcp", apiHost, tlsConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem like something that should be removed.
|
Reviewed during SIG-Auth is committed for Kube 1.35 so will not be able to reivew this for the current release cycle. |
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds support for compiling kubectl to webassembly. With both js and wasip1.
From a product perspective, having a kubectl inside a browser to perform some actions would be quite cool and would also help for training environment :) It would allow to spawn from the browser a version of kubectl that would not require an external shell/VM to run. It would be run in the browser.
Which issue(s) this PR is related to:
#128853
Special notes for your reviewer:
This is preliminary work to ensure that the compilation step is passing. Maybe other PRs will come to fix particular behaviours that are happening in the context.
I'm not familiar about how to specify a new target only for webassembly and kubectl. Obviously it makes no sense to have kubelet and other binaries supported in this OS/Arch for the time being.
At the time being there are two issues:
GOOS=jswe do not have access to the filesystem and that is a problem because kubectl needs to do a syscall to open a kubeconfig on the filesystem. One possible solution would be to have kubectl reading the entire kubeconfig from an environement variable inside the webassembly. This would be distinct from today as currentlykubectlonly reads path and perform an open. We would need to have an environment variable such asKUBECONFIG_INLINE/KUBECONFIG_RAW.GOOS=wasip1we do not have access to the terminal therefore all the code inmoby/termwould not work natively and it would need to be handle by polyfills in the browser. This would theoretically remove the need to have support for loading kubeconfig from an environment variable.Does this PR introduce a user-facing change?
User would be able to run kubectl in a browser that support webassembly which is pretty cool and would open new usage for running commands without requiring any pre-installation regardless of the platform.
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: