-
Notifications
You must be signed in to change notification settings - Fork 41.2k
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. Instructions 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 Instructions 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. |
Adding label Instructions 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. |
[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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Upstream PR for term moby/term#49 |
@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. Instructions 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. |
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=js
we 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 currentlykubectl
only reads path and perform an open. We would need to have an environment variable such asKUBECONFIG_INLINE
/KUBECONFIG_RAW
.GOOS=wasip1
we do not have access to the terminal therefore all the code inmoby/term
would 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.: