# 使用 Homebrew, Nix, zypper 安装 kubetrim

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

## 安装

```sh
sudo av install brew:kubetrim
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install kubetrim
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#kubetrim
```

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

- zypper (92%):

```sh
sudo zypper install kubetrim
```

  证据: openSUSE Tumbleweed package metadata: kubetrim from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:kubetrim
- **软件包管理器:** Homebrew
- **版本:** 0.0.2
- **来源摘要:** Trim your KUBECONFIG automatically
- **主页:** <https://github.com/alexellis/kubetrim>
- **仓库:** <https://github.com/alexellis/kubetrim>
- **最后更新:** 2026-07-27T21:58:47+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- kubetrim (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

kubetrim is a small Alex Ellis utility for pruning stale Kubernetes contexts and clusters from a kubeconfig. It is a deliberately narrow CLI: load a kubeconfig, test contexts, and write back the entries that still work.

### 项目历史

The project appeared as a compact Go repository with a README centered on one job: tidying old and broken cluster and context entries. Its own Q&A compares the tool to doing the work manually with kubectl config commands and notes that kubectx removes contexts but leaves additional cleanup steps.

### 采用历史

kubetrim is niche but package-manager friendly: the batch input records Homebrew, Nix, and zypper packaging, and the README documents arkade and release downloads. That footprint is typical for Alex Ellis utilities that solve a recurring operator annoyance with a small binary.

### 使用方式

Users run kubetrim against the kubeconfig selected by KUBECONFIG, optionally use --write=false for a dry run, and can keep unreachable contexts by listing them in ~/.local/kubetrim/keep.txt. The README also suggests cron or shell startup usage for people who accumulate short-lived clusters.

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

kubetrim matters less as a broad Kubernetes platform and more as a tiny example of packageable operational hygiene. It wraps a manual, error-prone kubectl config cleanup routine into a single command with conservative behavior when every cluster appears unreachable.

### 时间线

- 2024: The repository copyright and release series show the tool as an Alex Ellis Go CLI.
- 2024: v0.0.1 added the keep-file mechanism for unreachable clusters that should not be deleted.
- 2024: v0.0.2 added a timeout when checking cluster contexts.

### Related projects

- Related tools include kubectl config, kubectx, arkade, k3sup, and other small Kubernetes operator utilities. kubetrim complements kubectx by cleaning both context and cluster entries after connectivity checks.

### 来源

- <https://formulae.brew.sh/formula/kubetrim>
- <https://github.com/alexellis/kubetrim>
- <https://github.com/alexellis/kubetrim/releases>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- Nix - kubetrim: normalized package name match | nixpkgs package indexes: pkgs/by-name/ku/kubetrim/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- zypper - kubetrim - 0.0.1-1.9: normalized package name match | openSUSE Tumbleweed package metadata: kubetrim from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Trim your KUBECONFIG automatically | https://github.com/alexellis/kubetrim


## Combined YAML source

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


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
