k8s-helm
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHelm Chart Management
Helm Chart 管理
Comprehensive Helm v3 operations using kubectl-mcp-server's 16 Helm tools.
借助kubectl-mcp-server的16个Helm工具,实现全面的Helm v3操作。
When to Apply
适用场景
Use this skill when:
- User mentions: "helm", "chart", "release", "values", "repository"
- Operations: installing charts, upgrading releases, rollbacks
- Keywords: "package", "template", "lint", "repo add"
在以下场景中使用本技能:
- 用户提及:"helm"、"chart"、"release"、"values"、"repository"
- 操作需求:安装Chart、升级版本、回滚
- 关键词:"package"、"template"、"lint"、"repo add"
Priority Rules
优先级规则
| Priority | Rule | Impact | Tools |
|---|---|---|---|
| 1 | Template before install (dry run) | CRITICAL | |
| 2 | Check existing releases first | CRITICAL | |
| 3 | Lint charts before packaging | HIGH | |
| 4 | Note revision before upgrade | HIGH | |
| 5 | Verify values after upgrade | MEDIUM | |
| 6 | Update repos before search | LOW | |
| 优先级 | 规则 | 影响级别 | 工具 |
|---|---|---|---|
| 1 | 安装前先进行模板渲染(试运行) | 关键 | |
| 2 | 先检查已有的版本 | 关键 | |
| 3 | 打包前先对Chart进行校验 | 高 | |
| 4 | 升级前记录版本号 | 高 | |
| 5 | 升级后验证配置值 | 中 | |
| 6 | 搜索前更新仓库 | 低 | |
Quick Reference
快速参考
| Task | Tool | Example |
|---|---|---|
| Install chart | | |
| Upgrade release | | |
| Rollback | | |
| List releases | | |
| Get values | | |
| Template (dry run) | | |
| 任务 | 工具 | 示例 |
|---|---|---|
| 安装Chart | | |
| 升级版本 | | |
| 回滚 | | |
| 列出版本 | | |
| 获取配置值 | | |
| 模板渲染(试运行) | | |
Install Chart
安装Chart
python
install_helm_chart(
name="my-release",
chart="bitnami/nginx",
namespace="web",
values={"replicaCount": 3, "service.type": "LoadBalancer"}
)python
install_helm_chart(
name="my-release",
chart="bitnami/nginx",
namespace="web",
values={"replicaCount": 3, "service.type": "LoadBalancer"}
)Upgrade Release
升级版本
python
upgrade_helm_release(
name="my-release",
chart="bitnami/nginx",
namespace="web",
values={"replicaCount": 5}
)python
upgrade_helm_release(
name="my-release",
chart="bitnami/nginx",
namespace="web",
values={"replicaCount": 5}
)Rollback Release
回滚版本
python
rollback_helm_release(
name="my-release",
namespace="web",
revision=1
)python
rollback_helm_release(
name="my-release",
namespace="web",
revision=1
)Uninstall Release
卸载版本
python
uninstall_helm_chart(name="my-release", namespace="web")python
uninstall_helm_chart(name="my-release", namespace="web")Release Management
版本管理
List Releases
列出版本
python
list_helm_releases(namespace="web")
list_helm_releases()python
list_helm_releases(namespace="web")
list_helm_releases()Get Release Details
获取版本详情
python
get_helm_release(name="my-release", namespace="web")python
get_helm_release(name="my-release", namespace="web")Release History
版本历史
python
get_helm_history(name="my-release", namespace="web")python
get_helm_history(name="my-release", namespace="web")Get Release Values
获取版本配置值
python
get_helm_values(name="my-release", namespace="web")python
get_helm_values(name="my-release", namespace="web")Get Release Manifest
获取版本清单
python
get_helm_manifest(name="my-release", namespace="web")python
get_helm_manifest(name="my-release", namespace="web")Repository Management
仓库管理
Add Repository
添加仓库
python
add_helm_repo(name="bitnami", url="https://charts.bitnami.com/bitnami")python
add_helm_repo(name="bitnami", url="https://charts.bitnami.com/bitnami")List Repositories
列出仓库
python
list_helm_repos()python
list_helm_repos()Update Repositories
更新仓库
python
update_helm_repos()python
update_helm_repos()Search Charts
搜索Chart
python
search_helm_charts(keyword="nginx")
search_helm_charts(keyword="postgres", repo="bitnami")python
search_helm_charts(keyword="nginx")
search_helm_charts(keyword="postgres", repo="bitnami")Chart Development
Chart开发
Template Chart (Dry Run)
模板渲染Chart(试运行)
python
template_helm_chart(
name="my-release",
chart="./my-chart",
namespace="test",
values={"key": "value"}
)python
template_helm_chart(
name="my-release",
chart="./my-chart",
namespace="test",
values={"key": "value"}
)Lint Chart
校验Chart
python
lint_helm_chart(chart="./my-chart")python
lint_helm_chart(chart="./my-chart")Package Chart
打包Chart
python
package_helm_chart(chart="./my-chart", destination="./packages")python
package_helm_chart(chart="./my-chart", destination="./packages")Common Workflows
常见工作流
New Application Deployment
新应用部署
python
add_helm_repo(name="bitnami", url="...")
search_helm_charts(keyword="postgresql")
template_helm_chart(...)
install_helm_chart(...)
get_helm_release(...)python
add_helm_repo(name="bitnami", url="...")
search_helm_charts(keyword="postgresql")
template_helm_chart(...)
install_helm_chart(...)
get_helm_release(...)Upgrade with Rollback Safety
带回滚保障的升级
python
get_helm_history(name, namespace)
upgrade_helm_release(name, chart, namespace, values)
rollback_helm_release(name, namespace, revision)python
get_helm_history(name, namespace)
upgrade_helm_release(name, chart, namespace, values)
rollback_helm_release(name, namespace, revision)Multi-Environment Deployment
多环境部署
python
install_helm_chart(
name="app",
chart="./charts/app",
namespace="dev",
values={"replicas": 1},
context="development"
)
install_helm_chart(
name="app",
chart="./charts/app",
namespace="staging",
values={"replicas": 2},
context="staging"
)
install_helm_chart(
name="app",
chart="./charts/app",
namespace="prod",
values={"replicas": 5},
context="production"
)python
install_helm_chart(
name="app",
chart="./charts/app",
namespace="dev",
values={"replicas": 1},
context="development"
)
install_helm_chart(
name="app",
chart="./charts/app",
namespace="staging",
values={"replicas": 2},
context="staging"
)
install_helm_chart(
name="app",
chart="./charts/app",
namespace="prod",
values={"replicas": 5},
context="production"
)Chart Structure
Chart结构
See references/CHART-STRUCTURE.md for best practices on organizing Helm charts.
有关Helm Chart组织的最佳实践,请参阅references/CHART-STRUCTURE.md。
Troubleshooting
故障排查
See TROUBLESHOOTING.md for common issues.
常见问题请参阅TROUBLESHOOTING.md。
Release Stuck in Pending
版本卡在Pending状态
python
get_helm_release(name, namespace)
get_pods(namespace, label_selector="app.kubernetes.io/instance=<release>")python
get_helm_release(name, namespace)
get_pods(namespace, label_selector="app.kubernetes.io/instance=<release>")Failed Installation
安装失败
python
get_helm_history(name, namespace)
get_events(namespace)
uninstall_helm_chart(name, namespace)python
get_helm_history(name, namespace)
get_events(namespace)
uninstall_helm_chart(name, namespace)Values Not Applied
配置值未生效
python
get_helm_values(name, namespace)
template_helm_chart(...)
upgrade_helm_release(...)python
get_helm_values(name, namespace)
template_helm_chart(...)
upgrade_helm_release(...)Scripts
脚本
See scripts/lint-chart.sh for automated chart validation.
有关自动化Chart验证,请参阅scripts/lint-chart.sh。
Best Practices
最佳实践
-
Always Template Firstpython
template_helm_chart(name, chart, namespace, values) -
Use Semantic Versioningpython
install_helm_chart(..., version="1.2.3") -
Store Values in Git
values-dev.yamlvalues-staging.yamlvalues-prod.yaml
-
Namespace Isolation
- One namespace per release
- Easier cleanup and RBAC
-
始终先进行模板渲染python
template_helm_chart(name, chart, namespace, values) -
使用语义化版本python
install_helm_chart(..., version="1.2.3") -
将配置值存储在Git中
values-dev.yamlvalues-staging.yamlvalues-prod.yaml
-
命名空间隔离
- 每个版本对应一个命名空间
- 更易于清理和RBAC管理
Prerequisites
前置条件
- Helm CLI: Required for all Helm operations
bash
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- Helm CLI: 所有Helm操作都需要该工具
bash
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
Related Skills
相关技能
- k8s-deploy - Deployment strategies
- k8s-gitops - GitOps Helm releases
- k8s-deploy - 部署策略
- k8s-gitops - GitOps Helm版本管理