关于 helm-release-recovery
面向处理部署失败、发布卡住或状态损坏的 Helm 运维人员,提供恢复指导。内容涵盖回滚、发布历史与状态检查,以及常见恢复场景。
主要功能
- 01回滚到上一版或指定修订版
- 02查看发布历史和状态
- 03处理卡在 pending 状态的发布
- 04清理损坏的发布状态
- 05提供精简的 Helm 和 kubectl 命令
适用场景
- 01升级失败后恢复发布
- 02修复 pending-install 或 pending-upgrade 发布
- 03回滚前检查修订记录
- 04清理部分部署或损坏状态
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ laurigates/ claude-plugins --skill helm-release-recovery安装后在 Claude Code 中输入/helm-release-recovery确认已加载。
附带文件REFERENCE.md
详细介绍
Helm Release Recovery
有关从 Helm 部署失败中恢复、回滚 Release 以及管理卡住或损坏的 Release 状态的全面指南。
何时使用此技能
| 在以下情况下使用此技能…… | 在以下情况下改用 …… |
|---|---|
回滚失败的 helm upgrade 或恢复到之前的修订版本 | 对于未出问题的常规安装、升级和卸载流程,请使用 helm-release-management |
解除卡在 pending-install 或 pending-upgrade 状态的 Release | 如果根本原因是底层模板、值或渲染后的清单,请使用 helm-debugging |
| 清理损坏的 Release 密钥或部分部署 | 如果恢复需要检查单个 Pod 或节点,请使用 kubectl-debugging |
何时使用
在以下情况下自动使用此技能:
- 用户需要回滚失败或有问题的部署
- 用户报告 Release 卡住(pending-install、pending-upgrade)
- 用户提到升级失败或部分部署
- 用户需要从损坏的 Release 状态中恢复
- 用户想查看 Release 历史记录
- 用户需要清理失败的 Release
核心恢复操作
回滚到之前的修订版本
# Rollback to previous revision (most recent successful)
helm rollback <release> --namespace <namespace>
# Rollback to specific revision number
helm rollback <release> 3 --namespace <namespace>
# Rollback with wait and atomic behavior
helm rollback <release> \
--namespace <namespace> \
--wait \
--timeout 5m \
--cleanup-on-fail
# Rollback without waiting (faster but less safe)
helm rollback <release> \
--namespace <namespace> \
--no-hooks
关键标志:
--wait- 等待资源就绪--timeout- 等待的最长时间(默认 5m)--cleanup-on-fail- 回滚失败时删除新资源--no-hooks- 跳过运行回滚钩子--force- 通过删除并重新创建来强制更新资源--recreate-pods- 在适用时重启资源对应的 Pod
查看 Release 历史记录
# View all revisions
helm history <release> --namespace <namespace>
# View detailed history (YAML format)
helm history <release> \
--namespace <namespace> \
--output yaml
# Limit number of revisions shown
helm history <release> \
--namespace <namespace> \
--max 10
历史记录输出字段:
- REVISION:连续的版本号
- UPDATED:部署时间戳
- STATUS:deployed、superseded、failed、pending-install、pending-upgrade
- CHART:Chart 名称和版本
- APP VERSION:应用程序版本
- DESCRIPTION:发生的情况(Install complete、Upgrade complete、Rollback to X)
检查 Release 状态
# Check current release status
helm status <release> --namespace <namespace>
# Show deployed resources
helm status <release> \
--namespace <namespace> \
--show-resources
# Get status of specific revision
helm status <release> \
--namespace <namespace> \
--revision 5
常见恢复场景
场景 1:近期部署失败——简单回滚
症状:
- 近期升级或安装失败
- 部署后应用程序无法正常工作
- 想恢复到之前正常运行的版本
恢复步骤:
# 1. Check release status
helm status myapp --namespace production
# 2. View history to identify good revision
helm history myapp --namespace production
# Output example:
# REVISION STATUS CHART DESCRIPTION
# 1 superseded myapp-1.0.0 Install complete
# 2 superseded myapp-1.1.0 Upgrade complete
# 3 deployed myapp-1.2.0 Upgrade "myapp" failed
# 3. Rollback to previous working revision (2)
helm rollback myapp 2 \
--namespace production \
--wait \
--timeout 5m
# 4. Verify rollback
helm history myapp --namespace production
# 5. Verify application health
kubectl get pods -n production -l app.kubernetes.io/instance=myapp
helm status myapp --namespace production
场景 2:Release 卡住(pending-install/pending-upgrade)
症状:
helm list -n production
# NAME STATUS CHART
# myapp pending-upgrade myapp-1.0.0
恢复步骤:
# 1. Check what's actually deployed
kubectl get all -n production -l app.kubernetes.io/instance=myapp
# 2. Check release history
helm history myapp --namespace production
# Option A: Rollback to previous working revision
helm rollback myapp <previous-working-revision> \
--namespace production \
--wait
# Option B: Force new upgrade to unstick
helm upgrade myapp ./chart \
--namespace production \
--force \
--wait \
--atomic
# Option C: If rollback fails, delete and reinstall
# WARNING: This will cause downtime
helm uninstall myapp --namespace production --keep-history
helm install myapp ./chart --namespace production --atomic
# 3. Verify recovery
helm status myapp --namespace production
有关其他恢复场景(部分部署、历史记录损坏、回滚失败、级联故障)、历史记录管理、原子部署模式、恢复最佳实践、故障排查和 CI/CD 集成,请参阅 REFERENCE.md。
Agentic 优化
| 上下文 | 命令 |
|---|---|
| Release 历史记录(JSON) | helm history <release> -n <ns> --output json |
| Release 状态(JSON) | helm status <release> -n <ns> -o json |
| 修订版本的值(JSON) | helm get values <release> -n <ns> --revision <N> -o json |
| Pod 状态(精简) | kubectl get pods -n <ns> -l app.kubernetes.io/instance=<release> -o wide |
| Helm 密钥(列表) | kubectl get secrets -n <ns> -l owner=helm,name=<release> -o json |
相关技能
- Helm Release Management - 安装和升级操作
- Helm Debugging - 排查部署故障
- Helm Values Management - 管理配置
- Kubernetes Operations - 管理已部署的资源
参考资料
评论
支持 Markdown