Skip to content

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

remyleone
Copy link

@remyleone remyleone commented Aug 21, 2025

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:

  1. For 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 currently kubectl only reads path and perform an open. We would need to have an environment variable such as KUBECONFIG_INLINE/KUBECONFIG_RAW.
  2. For GOOS=wasip1 we do not have access to the terminal therefore all the code in moby/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.:

@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. labels Aug 21, 2025
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.34 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.34.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Thu Aug 21 08:00:27 UTC 2025.

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 21, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. labels Aug 21, 2025
@k8s-ci-robot
Copy link
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

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.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: remyleone
Once this PR has been reviewed and has the lgtm label, please assign soltysh for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 21, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in SIG CLI Aug 21, 2025
@remyleone
Copy link
Author

Upstream PR for term moby/term#49

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Aug 21, 2025

@remyleone: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-dependencies ad122bb link true /test pull-kubernetes-dependencies
pull-kubernetes-unit-windows-master ad122bb link false /test pull-kubernetes-unit-windows-master
pull-kubernetes-integration ad122bb link true /test pull-kubernetes-integration

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. kind/feature Categorizes issue or PR as related to a new feature. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. 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
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

2 participants