KubeDeckio/KubeBuddy

GitHub: KubeDeckio/KubeBuddy

KubeBuddy 是一个无侵入式的 Kubernetes 集群扫描和监控工具,专注于健康检查、资源洞察和安全审计。

Stars: 100 | Forks: 7

KubeBuddy


[![发布模块到 PowerShell Gallery](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/acb0073b94210121.svg)](https://github.com/KubeDeckio/KubeBuddy/actions/workflows/publish-psgal.yml) ![PowerShell Gallery 版本](https://img.shields.io/powershellgallery/v/KubeBuddy.svg) ![PowerShell 下载量](https://img.shields.io/powershellgallery/dt/KubeBuddy.svg) ![GitHub 下载量 (所有资源,所有版本)](https://img.shields.io/github/downloads/kubedeckio/kubebuddy/total?logo=homebrew&logoColor=%23FBB040&label=Brew%20Downloads) ![许可证](https://img.shields.io/github/license/KubeDeckIo/KubeBuddy.svg) **容器详情**
current version image tags image size

**KubeBuddy** 是一个 Kubernetes 和 AKS 扫描命令行工具,它可以帮助您检查集群健康状况、工作负载、网络、安全和平台配置,而无需在集群中安装任何东西。它生成 **HTML**、**JSON**、**文本** 和 **CSV** 报告,因此您可以交互式使用或在自动化流程中使用。 ## 文档 有关完整的安装、使用和高级配置说明,请访问 **[KubeBuddy 文档](https://kubebuddy.kubedeck.io)**。 ## 功能特性 ## 安装 ### **原生命令行工具** 从源代码构建原生命令行工具: ``` go build -o kubebuddy ./cmd/kubebuddy ``` 直接运行: ``` ./kubebuddy version ``` ### rShell Gallery, which is a repository for PowerShell modules. So, "PowerShell" is a proper noun (Microsoft PowerShell), and "Gallery" might be translated. In the example 'API Reference', "Reference" is translated, so here "Gallery" could be translated to something like "库" or "画廊", but in tech context, "PowerShell Gallery" is often kept as is or with "Gallery" translated. 使用 Homebrew 安装原生命令行工具: ``` brew tap KubeDeckio/homebrew-kubebuddy brew install kubebuddy ``` 然后验证安装: ``` kubebuddy version ``` ### Upon common usage, in Chinese, "PowerShell Gallery" might be referred to as "PowerShell 库" or "PowerShell Gallery" with "Gallery" translated to "库". But to follow the instruction, I should keep "PowerShell" in English and translate "Gallery" if it's not a proper noun. "PowerShell" is a tool name, so keep in English. "Gallery" is part of the name, but it might be considered a common noun. In the example 'Kubernetes Setup', "Setup" is translated, so similarly, "Gallery" could be translated. 要使用 PowerShell 安装 **KubeBuddy**: ``` Install-Module -Name KubeBuddy -Repository PSGallery -Scope CurrentUser ``` PowerShell 模块现在是原生 `kubebuddy` 二进制文件的兼容性包装器,并为支持的平台附带捆绑的二进制文件。正常使用时,`Invoke-KubeBuddy` 在安装后应能立即工作。仅在您想强制指定特定二进制文件路径时才需要设置 `KUBEBUDDY_BINARY`。 ### **平台支持** - **原生命令行工具:** 可在任何 Go 构建的二进制文件和您的 Kubernetes 工具链可用的地方运行。 - **PowerShell 模块:** 可在 **Windows**、**macOS** 和 **Linux** 上运行。 有关其他安装方法,请参阅 **[KubeBuddy 文档](https://kubebuddy.kubedeck.io)。** ## 使用方法 ### **原生命令行工具命令** 启动引导式 Buddy 流程: ``` ./kubebuddy guided ``` 从原生命令行工具运行完整的 KubeBuddy 引擎: ``` ./kubebuddy run --html-report --yes --output-path ./reports ``` 运行原生 Kubernetes 探测: ``` ./kubebuddy probe ``` 运行原生 Kubernetes 摘要: ``` ./kubebuddy summary ``` 运行声明式原生扫描路径: ``` ./kubebuddy scan --output json ``` 针对 AKS JSON 文档运行 AKS YAML 检查: ``` ./kubebuddy scan-aks --input ./aks-cluster.json --output html ``` ### **PowerShell 命令** 在 PowerShell 中运行 **KubeBuddy**: ``` Invoke-KubeBuddy ``` 在 PowerShell 中运行 **KubeBuddy** 并选择进行 AKS 健康检查: ``` Invoke-KubeBuddy -aks -SubscriptionId -ResourceGroup -ClusterName ``` ### **生成报告** - **HTML 报告:** ./kubebuddy run --html-report --yes --output-path ./reports 或 Invoke-KubeBuddy -HtmlReport - **文本报告:** ./kubebuddy run --txt-report --yes --output-path ./reports 或 Invoke-KubeBuddy -txtReport - **CSV 报告:** ./kubebuddy run --csv-report --yes --output-path ./reports 或 Invoke-KubeBuddy -CsvReport 将扫描结果导出到 `.csv` 文件,包含以下列:`ID`、`Name`、`Category`、`Severity`、`Status`、`Message`、`Recommendation`、`URL`。适用于电子表格、仪表板或审计日志。 - **将 AKS 最佳实践部分添加到 HTML 报告:** ./kubebuddy run --html-report --aks --subscription-id --resource-group --cluster-name --yes --output-path ./reports 或 Invoke-KubeBuddy -HtmlReport -aks -SubscriptionId -ResourceGroup -ClusterName - **将 AKS 最佳实践部分添加到文本报告:** ./kubebuddy run --txt-report --aks --subscription-id --resource-group --cluster-name --yes --output-path ./reports 或 Invoke-KubeBuddy -txtReport -aks -SubscriptionId -ResourceGroup -ClusterName - **将 AKS 最佳实践添加到 CSV 报告:** ./kubebuddy run --csv-report --aks --subscription-id --resource-group --cluster-name --yes --output-path ./reports 或 Invoke-KubeBuddy -CsvReport -aks -SubscriptionId -ResourceGroup -ClusterName ### **上传到 KubeBuddy Radar (专业版)** ``` export KUBEBUDDY_RADAR_API_USER="" export KUBEBUDDY_RADAR_API_PASSWORD="" ./kubebuddy run --json-report --radar-upload --radar-environment prod --yes --output-path ./reports ``` 或 ``` $env:KUBEBUDDY_RADAR_API_USER = "" $env:KUBEBUDDY_RADAR_API_PASSWORD = "" Invoke-KubeBuddy -jsonReport -RadarUpload -RadarEnvironment "prod" ``` 一次运行完成上传+比较: ``` ./kubebuddy run --json-report --radar-upload --radar-compare --radar-environment prod --yes --output-path ./reports ``` 或 ``` Invoke-KubeBuddy -jsonReport -RadarUpload -RadarCompare -RadarEnvironment "prod" ``` 获取已保存的 Radar 集群配置并使用它运行: ``` ./kubebuddy run --radar-fetch-config --radar-config-id "" --yes ``` 或 ``` Invoke-KubeBuddy -RadarFetchConfig -RadarConfigId "" ``` ## 配置 **KubeBuddy** 使用一个 YAML 配置文件 (`kubebuddy-config.yaml`) 来定义阈值、排除项、受信任的注册表和 Radar 默认设置: ``` thresholds: cpu_warning: 50 cpu_critical: 75 mem_warning: 50 mem_critical: 75 restarts_warning: 3 restarts_critical: 5 pod_age_warning: 15 pod_age_critical: 40 stuck_job_hours: 2 failed_job_hours: 2 event_errors_warning: 10 event_errors_critical: 20 event_warnings_warning: 50 event_warnings_critical: 100 excluded_namespaces: - kube-system - gatekeeper-system trusted_registries: - mcr.microsoft.com/ excluded_checks: - SEC014 ``` 您也可以在不编辑配置文件的情况下为单次运行排除某些检查: ``` ./kubebuddy run --html-report --excluded-checks SEC014,WRK011 --yes ./kubebuddy scan --output json --excluded-checks SEC014,WRK011 ``` ``` Invoke-KubeBuddy -HtmlReport -ExcludedChecks "SEC014","WRK011" ``` 此文件应放置在: ``` ~/.kube/kubebuddy-config.yaml ``` 如果文件缺失,**KubeBuddy** 将回退到默认设置。 ## 更新日志 该项目所有显著更改都记录在 **[更新日志](./CHANGELOG.md)** 中。 ## 许可证 该项目根据 **MIT 许可证** 授权。详情请参阅 [LICENSE](./LICENSE) 文件。
标签:AI合规, AKS, EVTX分析, Go语言, IPv6, PowerShell, 健康检查, 子域名突变, 容器编排, 平台配置, 快照监控, 提示注入, 日志审计, 监控工具, 程序破解, 自动化运维, 资源监控, 集群扫描, 集群管理, 非侵入式监控