# 错误：升级失败：值不符合以下图表模板的规范：模板"deployment.yaml"缺少必需的值

- **ID:** `kubernetes/helm-upgrade-failed-missing-values`
- **领域:** kubernetes
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 87%

## 根因

Helm升级失败，因为提供的values.yaml缺少图表模板所需的键，通常是由于新图表版本增加了必需字段。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Helm v3.14.0 | active | — | — |
| Helm v3.13.3 | active | — | — |
| Kubernetes v1.28.4 | active | — | — |

## 解决方案

1. ```
   Inspect the chart for required values: `helm show values <chart-name>` and compare with your values.yaml. Add missing keys, e.g., if the chart requires `service.port`, add `service: {port: 8080}` to your values file.
   ```
2. ```
   Use `helm upgrade --install --dry-run --debug` to see the template rendering errors and identify exactly which values are missing.
   ```

## 无效尝试

- **Run `helm upgrade --reuse-values` to reuse old values** — Reusing old values doesn't supply the missing required keys from the new chart version. It will still fail with the same error. (95% 失败率)
- **Delete the release and reinstall with `helm install`** — Deleting the release may cause data loss (e.g., PVCs may be orphaned). Also, the install will fail for the same reason if values are missing. (80% 失败率)
