kubernetes/kubectl: the staging repo behind the k8s.io/kubectl Go packages
Issue tracker and mirror of kubectl code
At a glance
- What is it?
- The GitHub repository kubernetes/kubectl is a read-only staging mirror and the issue tracker for the kubectl CLI shipped with Kubernetes. This article covers what its Go packages are for, how a program imports them, and why most users should not clone it.
- Who is it for?
- Adopt this repository as a Go dependency, not as a source checkout: import k8s.io/kubectl for the packages that ship with kubectl, and file CLI bugs against kubernetes/kubernetes because this mirror is read-only for importing. If you need the kubectl binary itself, take it from a Kubernetes release rather than from this tree, and check the go.mod replace directives before you build against the module.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly Go, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 14, 2026, and from our analysis. They are not legal advice.
Star history
- kubernetes/kubectl3,369 ★ · +23
| Repository | 2026-09-24 | 2026-11-14 |
|---|---|---|
| kubernetes/kubectl | 3.3k | 3.4k |
23 Stars in the last 51 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What kubernetes/kubectl actually is, and who it is for
The README opens with a warning badge: this is an automatically published staged repository for Kubernetes, pull requests should be made to the main Kubernetes repository, and the repository is read-only for importing. That single sentence explains most of the confusion around the name. The repository description says it is an issue tracker and mirror of kubectl code, and the README adds that the k8s.io/kubectl repo tracks issues for the kubectl CLI distributed with k8s.io/kubernetes. It also contains packages intended for use by client programs, which are vendored into k8s.io/kubernetes for use in the kubectl CLI client.
So there are two audiences here, and they want different things. The first is anyone filing or triaging a bug in the kubectl command line: this repo is where that issue lands, even though the code lives elsewhere. The second is a Go developer writing a tool that needs kubectl behaviour, such as resource printing, editing or apply logic, without depending on the whole Kubernetes tree. The README states plainly that the client will eventually move here too, which is a future tense, not a current fact.
If you arrived looking for a kubectl download, this page will disappoint you. The repository has no releases, no install script and no binary artifacts in its top level. What it has is Go source under pkg/, a go.mod, docs/, images/ and testdata/.
How the staging mechanism shapes the code you get
Kubernetes keeps some libraries in the main kubernetes/kubernetes tree and publishes them outward as separate modules. This repository is one of those published copies. The README links to the Kubernetes staging documentation for the mechanism, and the practical consequence is that the git history here is generated, not authored. Commits appear as imports. If you open a pull request against this mirror it will not be reviewed.
The contribution requirements in the README are written for code destined to be staged out of the main tree, which tells you what the packages are expected to look like. Full unit-test coverage. Go tools compliant, so go get and go test work and the code needs to be vendorable somewhere else. No dependence on k8s.io/kubernetes, though dependence on other repositories is fine. Useful comments, for external users of the packages and not only for developers on the project. Packages should aspire to implement sensible, small interfaces and import a limited set of dependencies.
That last rule is the one that matters when you depend on the module. A library that cannot import k8s.io/kubernetes is a library that will not drag the API server into your binary. The cost is that anything requiring server-side types has to come in through k8s.io/api, k8s.io/apimachinery and k8s.io/client-go instead, which is why the go.mod requires all three alongside smaller helpers such as spf13/cobra, liggitt/tabwriter, moby/term and sigs.k8s.io/kustomize/kustomize/v5.
Importing k8s.io/kubectl in a Go program
The module path is declared in go.mod as k8s.io/kubectl, and go.mod carries a header saying it is a generated file that should not be edited directly. Add the dependency the normal way and let Go resolve the pseudo-version from the mirror.
go get k8s.io/kubectlAfter that command the module appears in your go.mod with a pseudo-version, the same form the repository itself uses for its Kubernetes dependencies, for example k8s.io/api v0.0.0-20260918144955-756f73143d0a. There is no tagged release to pin to in this repository, so the version you get is a commit date and hash rather than a semantic version. That is worth knowing before you plan upgrades.
Because the module is generated from the main tree, a local checkout is not the intended workflow. If you do clone it, the README's requirement that the code be vendorable and Go-tools compliant means the standard commands are expected to work:
go build ./...
go test ./...What you should see is compilation of the packages under pkg/ against the dependency set in go.mod. The go.mod file is truncated in the published view, so a fresh checkout may pull in replace directives or indirect requirements that are not visible from the README alone. Read the full go.mod before you assume the dependency graph is small.
Where this repository is the wrong tool
If you want the kubectl binary, this is the wrong place. There are no releases here, the homepage field is empty, and the README points at the CLI distributed with k8s.io/kubernetes. Installing from this repository means building it yourself from a mirror whose own documentation says contributions do not happen here.
If you want to fix a bug in kubectl, this is also the wrong place to open a pull request. The README is explicit that pull requests should be made to the main Kubernetes repository and that this repository is read-only for importing. An issue filed here is fine, since tracking issues is one of the stated purposes, but a patch is not.
The third case is subtler. If your program needs kubectl behaviour and you want a stable API surface, the staging model works against you. The module has no releases, versions are pseudo-versions tied to commit timestamps, and the code is regenerated from another repository. You are depending on a moving target whose changelog lives somewhere else. Teams that need to audit every dependency change will find that the audit trail runs through kubernetes/kubernetes, not through this repo. That is a real cost, not a documentation gap.
One more boundary: the README says the kubectl client will eventually move here. It has not, based on the repository contents, which show packages, docs and testdata rather than a cmd/kubectl entry point in the top-level listing.
The alternative: depend on client-go and the CLI runtime directly
The obvious alternative for a Go program that talks to a cluster is to skip this module and depend on k8s.io/client-go, k8s.io/cli-runtime and k8s.io/apimachinery directly. The difference in approach is about where the kubectl-specific behaviour lives. client-go gives you clients, informers, discovery and configuration loading. cli-runtime gives you the pieces the CLI itself builds on, such as resource builders and printing. This repository sits one layer up: it holds the packages that implement kubectl's own commands, which is why the README describes them as vendored into k8s.io/kubernetes for the kubectl client.
Choosing between them is a question of how much kubectl semantics you want. If you need your tool to print resources the way kubectl prints them, or to share edit and apply behaviour, the packages here save you from reimplementing that. If you only need to list pods and watch them, client-go alone is a smaller dependency and a more stable one, since it is a first-class module with its own release cadence rather than a staging mirror.
The second alternative is not a library at all: shell out to the kubectl binary. That trades a Go dependency for a runtime dependency on a specific CLI version, and it puts output parsing in your hands. For a one-off script that is often the right call. For a long-running service it usually is not, because you inherit whatever kubectl is on the host.
Maintenance, licensing and what an upgrade costs you
The repository is not archived, and the last push was on 2026-09-21. That date is consistent with the generated nature of the tree: staging imports land regularly as the main repository moves, so activity here reflects upstream commits rather than maintenance of this repo as a product. There is no separate release process to follow and no changelog in the repository listing.
Upgrades therefore mean moving the pseudo-version in your go.mod, which pulls whatever the mirror contained at that commit. Because the module requires k8s.io/api, k8s.io/apimachinery, k8s.io/client-go and k8s.io/component-base at matching pseudo-versions, a bump here usually forces bumps across all of them. Plan for that: a single go get can cascade into several dependency updates in one commit, and the go.mod header warning that the file is generated means you should not hand-edit it to pin around the problem.
On licensing, the repository carries an Apache-2.0 LICENSE file and the README notes that participation in the Kubernetes community is governed by the Kubernetes Code of Conduct, with security contacts and an OWNERS file at the top level. Apache-2.0 permits commercial use and modification and includes a patent grant. It also requires that you keep the licence and notice files when you redistribute. That is a general description of the licence text, not legal advice; check the LICENSE file and your own obligations before shipping.
Editorial conclusion
Adopt this repository as a Go dependency, not as a source checkout: import k8s.io/kubectl for the packages that ship with kubectl, and file CLI bugs against kubernetes/kubernetes because this mirror is read-only for importing. If you need the kubectl binary itself, take it from a Kubernetes release rather than from this tree, and check the go.mod replace directives before you build against the module.
Frequently asked questions
What is the use of kubectl?
kubectl is the command line client distributed with Kubernetes. This repository tracks issues for that CLI and holds the Go packages that are vendored into k8s.io/kubernetes for use in it.
Is kubectl the same as Kubernetes?
No. Kubernetes is the system; kubectl is the CLI client shipped with it. The README describes this repo as tracking issues for the kubectl CLI distributed with k8s.io/kubernetes, and as containing packages used by client programs.
How do I install kubectl from this repository?
You do not. The repository has no releases and no install instructions; the README points to the kubectl CLI distributed with k8s.io/kubernetes. What you can do here is add k8s.io/kubectl as a Go module dependency.
Where should I send a pull request for kubectl?
To the main Kubernetes repository at github.com/kubernetes/kubernetes. The README states that pull requests should be made there and that this repository is read-only for importing.
Why is the go.mod in kubernetes/kubectl marked as generated?
The file opens with a comment saying it is generated and should not be edited directly, which matches the README's description of this as an automatically published staged repository. Dependency changes are expected to originate upstream.
Does the k8s.io/kubectl module have tagged releases?
The repository has no published GitHub releases, and its own go.mod pins Kubernetes dependencies by pseudo-version, for example k8s.io/api v0.0.0-20260918144955-756f73143d0a. Expect to depend on commit-based versions.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/kubernetes-kubectl)Star history chart for your README
[](https://hysenlabs.com/projects/kubernetes-kubectl)Was this useful?