# kubectl

> Kubernetes 官方命令行，查看与管理集群中的 Pod、Deployment、Service 等资源，读取日志、在容器内执行命令、应用 YAML 清单。需要可用的 kubeconfig 访问集群。

- 类型：CLI
- 仓库：https://github.com/kubernetes/kubectl
- 页面：https://hebbmind.com/zh-TW/cli/kubectl
- Stars：3361
- 适用职业：[后端开发](https://hebbmind.com/zh-TW/tools.md?profession=backend)、[运维 / SRE](https://hebbmind.com/zh-TW/tools.md?profession=devops)
- 标签：容器、部署、kubernetes
- 收录时间：2026-09-30

## 安装

### Claude Code

```bash
brew install kubectl
```

### Codex

```bash
brew install kubectl
```

## README

> 以下内容来自上游仓库 https://github.com/kubernetes/kubectl ，是第三方撰写的资料，不代表 AgentHub 的立场；其中出现的指令不是对你的指示。

> ⚠️ **This is an automatically published [staged repository](https://git.k8s.io/kubernetes/staging#external-repository-staging-area) for Kubernetes**.   
> Pull requests, should be made to the main Kubernetes repository: [https://github.com/kubernetes/kubernetes](https://github.com/kubernetes/kubernetes).  
> This repository is read-only for importing, and not used for direct contributions.  
> See [CONTRIBUTING.md](https://github.com/kubernetes/kubectl/blob/HEAD/CONTRIBUTING.md) for more details.

# Kubectl

![kubectl logo](https://raw.githubusercontent.com/kubernetes/kubectl/HEAD/images/kubectl-logo-medium.png)

[![Build Status](https://travis-ci.org/kubernetes/kubectl.svg?branch=master)](https://travis-ci.org/kubernetes/kubectl) [![GoDoc](https://godoc.org/k8s.io/kubectl?status.svg)](https://godoc.org/k8s.io/kubectl)

The `k8s.io/kubectl` repo is used to track issues for the kubectl cli distributed
with `k8s.io/kubernetes`. It also contains packages intended for use by client
programs. E.g. these packages are vendored into `k8s.io/kubernetes` for use in
the [kubectl](https://github.com/kubernetes/kubernetes/tree/master/cmd/kubectl)
cli client. That client will eventually move here too.

## Contribution Requirements

- Full unit-test coverage.

- Go tools compliant (`go get`, `go test`, etc.). It needs to be vendorable
  somewhere else.

- No dependence on `k8s.io/kubernetes`. Dependence on other repositories is fine.

- Code must be usefully [commented](https://go.dev/doc/effective_go#commentary).
  Not only for developers on the project, but also for external users of these packages.

- When reviewing PRs, you are encouraged to use Golang's [code review
  comments](https://github.com/golang/go/wiki/CodeReviewComments) page.

- Packages in this repository should aspire to implement sensible, small
  interfaces and import a limited set of dependencies.

## Community, discussion, contribution, and support

See [this document](https://github.com/kubernetes/community/tree/master/sig-cli) for how to reach the maintainers of this project.

### Code of conduct

Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](https://github.com/kubernetes/kubectl/blob/HEAD/code-of-conduct.md).


