# 使用 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
- **软件包管理器页面:** <https://formulae.brew.sh/formula/kubectl-cnpg>
- **版本:** 1.30.0
- **来源摘要:** CloudNativePG plugin for kubectl
- **主页:** <https://cloudnative-pg.io/>
- **仓库:** <https://github.com/cloudnative-pg/cloudnative-pg>
- **上游文档:** <https://cloudnative-pg.io/>
- **许可证:** Apache-2.0
- **源码归档:** <https://github.com/cloudnative-pg/cloudnative-pg.git>
- **最后更新:** 2026-07-27T21:58:44+02:00
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

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

## 构建依赖

- go

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 1.30.0
- 管理器更新时间: 2026-07-27
- 本地数据: OK
- 上游仓库: https://github.com/cloudnative-pg/cloudnative-pg
- 信息: No cached GitHub release or tag data was available.
## 项目历史与用法

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
## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** kubectl-cnpg
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

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

- 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


## 相关链接

- [Cloud CLI packages](https://pkg.so/zh-hans/cloud-clis/) - Belongs to a cloud or infrastructure command family.
- [Secret-risk packages](https://pkg.so/zh-hans/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/zh-hans/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [go](https://pkg.so/zh-hans/brew/go/) - Build dependency declared by Homebrew.
- [kubectl-rook-ceph](https://pkg.so/zh-hans/brew/kubectl-rook-ceph/) - Shares pkgdb curated category or tags: cli, developer-tools, kubectl-plugin, kubernetes.
- [kubectl-tree](https://pkg.so/zh-hans/brew/kubectl-tree/) - Shares pkgdb curated category or tags: cli, developer-tools, kubectl-plugin, kubernetes.
- [kubecolor](https://pkg.so/zh-hans/brew/kubecolor/) - Shares pkgdb curated category or tags: cli, developer-tools, kubectl-plugin, kubernetes.
- [kubeconform](https://pkg.so/zh-hans/brew/kubeconform/) - Shares pkgdb curated category or tags: cli, developer-tools, kubernetes.
- [minikube](https://pkg.so/zh-hans/brew/minikube/) - Shares pkgdb curated category or tags: cli, developer-tools, kubernetes.
- [kind](https://pkg.so/zh-hans/brew/kind/) - Shares pkgdb curated category or tags: cli, developer-tools, kubernetes.
- [kubectx](https://pkg.so/zh-hans/brew/kubectx/) - Shares pkgdb curated category or tags: cli, developer-tools, kubernetes.
- [kubelogin](https://pkg.so/zh-hans/brew/kubelogin/) - Shares pkgdb curated category or tags: cli, developer-tools, kubernetes.
- [kubectl-explore](https://pkg.so/zh-hans/brew/kubectl-explore/) - Package names and metadata indicate a similar tool family. Shared terms: cli, developer, developer-tools, kubectl, kubectl-plugin.

## 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
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
