# 使用 Homebrew, apk, Nix, zypper 安装 kubectl-cnpg

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

## 安装

```sh
sudo av install brew:kubectl-cnpg
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install kubectl-cnpg
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add kubectl-cnpg
```

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

- Nix (92%):

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

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

- zypper (92%):

```sh
sudo zypper install kubectl-cnpg
```

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

## 软件包事实

- **软件包键:** brew:kubectl-cnpg
- **软件包管理器:** Homebrew
- **版本:** 1.30.0
- **来源摘要:** CloudNativePG plugin for kubectl
- **主页:** <https://cloudnative-pg.io/>
- **仓库:** <https://github.com/cloudnative-pg/cloudnative-pg>
- **最后更新:** 2026-07-27T21:58:44+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- kubectl-cnpg (别名)
- kubectl_complete-cnpg (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

kubectl-cnpg is the kubectl plugin shipped by the CloudNativePG project for managing PostgreSQL clusters on Kubernetes. The plugin is part of the main CloudNativePG repository rather than a separate utility repository.

### 项目历史

The CloudNativePG GitHub repository was created on 2022-03-10. The project describes CloudNativePG as a platform for managing PostgreSQL databases in Kubernetes across the operational lifecycle, and its repository topics include `kubectl-plugin`, `operator`, `postgresql`, and high-availability concepts.

The kubectl plugin became one of the operator's user-facing control surfaces: the official plugin documentation covers installation scripts, Debian and RPM packages, AUR, Krew, Homebrew, supported architectures, completion, and command usage.

### 采用历史

The plugin's adoption follows CloudNativePG adoption rather than an independent CLI culture. The package appears in Homebrew, APK, Nix, and zypper, and the official docs name Homebrew and Krew as supported install paths for workstation users.

The repository metadata observed on 2026-07-01 showed more than 8000 GitHub stars for CloudNativePG, which makes kubectl-cnpg a plugin attached to a prominent Kubernetes database operator rather than a tiny standalone addon.

### 使用方式

After installation, users run commands as `kubectl cnpg COMMAND [ARGS...]`. The official documentation emphasizes management tasks such as generating installation manifests and interacting with CloudNativePG-managed database clusters.

The plugin uses the normal kubectl configuration path through `~/.kube/config`, so it fits existing Kubernetes authentication and context workflows rather than defining a separate credentials store.

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

kubectl-cnpg is interesting as a packaged operator companion: the binary is distributed across OS package systems even though its value is tied to a cluster-side controller. It shows how serious Kubernetes operators often grow their own kubectl plugin for operational ergonomics.

### 时间线

- 2022-03-10: CloudNativePG repository created.
- 2025-05-08: CloudNativePG release v1.29.1 published.
- 2026-06-29: CloudNativePG release v1.30.0 published, with plugin package examples in the documentation using v1.30.0 assets.

### Related projects

- Related projects include Kubernetes, kubectl, Krew, PostgreSQL, and the CloudNativePG operator. The package is not a general PostgreSQL client; it is an operational frontend for CloudNativePG resources.

### 来源

- <https://api.github.com/repos/cloudnative-pg/cloudnative-pg>
- <https://cloudnative-pg.io/docs/devel/kubectl-plugin>
- <https://cloudnative-pg.io/documentation/current/kubectl-plugin>
- <https://formulae.brew.sh/formula/kubectl-cnpg>
- <https://github.com/cloudnative-pg/cloudnative-pg>
- <https://krew.sigs.k8s.io/docs/user-guide/setup/install/>


## 安全说明

infrastructure mutation or orchestration signal.

- **Geiger 风险:** orange / 中
- infrastructure mutation or orchestration signal


## 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
## 其他软件包管理器记录

- Nix - kubectl-cnpg: normalized package name match | nixpkgs package indexes: pkgs/by-name/ku/kubectl-cnpg/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- apk - kubectl-cnpg - 1.30.0-r1: normalized package name match | Alpine Linux edge package indexes: kubectl-cnpg from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | kubectl plugin for cloudnative-pg | https://github.com/cloudnative-pg/cloudnative-pg
- zypper - kubectl-cnpg - 1.29.2-1.3: normalized package name match | openSUSE Tumbleweed package metadata: kubectl-cnpg from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Manage PostgreSQL clusters built using CloudNativePG | https://github.com/cloudnative-pg/cloudnative-pg
- zypper - kubectl-cnpg-bash-completion - 1.29.2-1.3: normalized package name match | openSUSE Tumbleweed package metadata: kubectl-cnpg-bash-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Bash Completion for kubectl-cnpg | https://github.com/cloudnative-pg/cloudnative-pg
- zypper - kubectl-cnpg-fish-completion - 1.29.2-1.3: normalized package name match | openSUSE Tumbleweed package metadata: kubectl-cnpg-fish-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Fish Completion for kubectl-cnpg | https://github.com/cloudnative-pg/cloudnative-pg
- zypper - kubectl-cnpg-zsh-completion - 1.29.2-1.3: normalized package name match | openSUSE Tumbleweed package metadata: kubectl-cnpg-zsh-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Zsh Completion for kubectl-cnpg | https://github.com/cloudnative-pg/cloudnative-pg


## Combined YAML source

View the package source record on GitHub. [combined/kubectl-cnpg.yml](https://github.com/mxcl/pkgdb/blob/main/combined/kubectl-cnpg.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
