# 使用 Homebrew, chocolatey, winget, apk, apt, MacPorts, Nix, pacman, scoop 安装 kubernetes-cli

查看 kubernetes-cli 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:kubernetes-cli
```

## 代理安全回答

kubernetes-cli provides kubectl, which controls Kubernetes clusters and workloads.

- **凭据访问:** Reads kubeconfig, exec credentials, cluster tokens, and namespace context.
- **远程变更:** Can create, patch, delete, scale, and exec into cluster workloads.
- **发布/制品风险:** Can apply manifests that deploy or expose application artifacts.
- **推荐控制:** Gate kubectl apply, delete, patch, exec, port-forward, and context changes.
- **代理使用指南:** Allow get/describe with safe contexts; require approval for cluster writes and secret reads.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install kubernetes-cli
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install kubectl
```

  证据: MacPorts ports tree: sysutils/kubectl/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add kubectl
```

  证据: Alpine Linux edge package indexes: kubectl from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install kubectl
```

  证据: Debian stable package indexes: kubectl from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#kubectl
```

  证据: nixpkgs package indexes: pkgs/by-name/ku/kubectl/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S kubectl
```

  证据: Arch Linux sync databases: kubectl from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

### Windows

- Chocolatey (92%):

```sh
choco install kubernetes-cli
```

  证据: Chocolatey community package catalog: kubernetes-cli from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','kindle'

- winget (92%):

```sh
winget install --id Kubernetes.kubectl -e
```

  证据: Windows Package Manager source index: Kubernetes.kubectl from https://cdn.winget.microsoft.com/cache/source.msix

- Scoop (92%):

```sh
scoop install main/kubectl
```

  证据: Scoop official bucket manifest trees: bucket/kubectl.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:kubernetes-cli
- **软件包管理器:** Homebrew
- **版本:** 1.36.3
- **来源摘要:** Kubernetes command-line interface
- **主页:** <https://kubernetes.io/docs/reference/kubectl/>
- **仓库:** <https://github.com/kubernetes/kubernetes>
- **最后更新:** 2026-07-23T03:43:20Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- kubectl (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.36.3
## 项目历史与用法

kubectl is the Kubernetes command-line client and the binary packaged by Homebrew as kubernetes-cli. It is the standard local interface for sending requests to the Kubernetes control plane, reading and writing objects, inspecting resources, and driving day-to-day cluster operations.

### 项目历史

Kubernetes began as an open source Google project in 2014 and reached version 1.0 on July 21, 2015, alongside Google's announcement that the project would be donated to the newly formed Cloud Native Computing Foundation. kubectl evolved with the project as the human-facing client for the Kubernetes API.

### 采用历史

As Kubernetes became the common substrate for cloud-native infrastructure, kubectl became one of the most widely installed operations binaries in developer and platform-engineering toolchains. Its packaging across Homebrew, Linux distributions, Chocolatey, Scoop, winget, Nix, MacPorts, and other systems reflects that it is both a developer tool and an infrastructure administration tool.

### 使用方式

kubectl reads kubeconfig data to select a cluster, user, namespace, and context, then communicates with the API server. Kubernetes documentation says kubectl looks for config in $HOME/.kube/config by default, while KUBECONFIG and --kubeconfig allow explicit or merged configuration files.

### 为什么软件包爱好者会关心

The kubernetes-cli package is significant because it decouples the local client from a full Kubernetes installation. Package managers let users pin or upgrade the client, match cluster version-skew policy, and keep scripts using a predictable kubectl binary without installing control-plane components.

### 时间线

- 2014: Kubernetes was released as an open source project.
- 2015-07-21: Kubernetes 1.0 was released and the project was donated to the CNCF.
- 2023-08-15: Kubernetes documented pkgs.k8s.io as community-owned package repositories for Kubernetes packages.
- 2025-04-23: Kubernetes v1.33 was released.
- 2025-08-27: Kubernetes v1.34 was released.

### Related projects

- kubectl is related to the Kubernetes API server, kubeconfig, client-go, kubeadm, kustomize, Helm, kubectl plugins, and the broader SIG CLI tooling ecosystem.

### 来源

- <https://kubernetes.io/blog/2024/06/06/10-years-of-kubernetes/>
- <https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/>
- <https://kubernetes.io/docs/reference/kubectl/>
- <https://kubernetes.io/releases/>


## 安全说明

cluster orchestration infrastructure.

- **Geiger 风险:** orange / 高
- cluster orchestration infrastructure


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: ~/.kube/config

## Credential files

- Unix: ~/.kube/config
## 其他软件包管理器记录

- Chocolatey - kubernetes-cli: normalized package name match | Chocolatey community package catalog: kubernetes-cli from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','kindle'
- winget - Kubernetes.kubectl: normalized package name match | Windows Package Manager source index: Kubernetes.kubectl from https://cdn.winget.microsoft.com/cache/source.msix
- MacPorts - kubectl: installed executable or alias match | MacPorts ports tree: sysutils/kubectl/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Debian apt - kubectl - 1.32.3+ds-2: installed executable or alias match | Debian stable package indexes: kubectl from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Command-line tool for controlling Kubernetes clusters | https://kubernetes.io/
- Nix - kubectl: installed executable or alias match | nixpkgs package indexes: pkgs/by-name/ku/kubectl/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - kubectl - 1.36.3-r0: installed executable or alias match | Alpine Linux edge package indexes: kubectl from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Kubernetes - kubectl | https://kubernetes.io/
- pacman - kubectl - 1.36.3-1: installed executable or alias match | Arch Linux sync databases: kubectl from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A command line tool for communicating with a Kubernetes API server | https://kubernetes.io/
- Scoop - main/kubectl: installed executable or alias match | Scoop official bucket manifest trees: bucket/kubectl.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/kubernetes-cli.yml](https://github.com/mxcl/pkgdb/blob/main/combined/kubernetes-cli.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
