{
  "id": "kubernetes/helm-upgrade-failed-drifted-resources",
  "signature": "Error: UPGRADE FAILED: rendered manifests contain a resource that already exists. Unable to continue with update",
  "signature_zh": "错误：升级失败：渲染的清单包含已存在的资源。无法继续更新",
  "regex": "UPGRADE FAILED: rendered manifests contain a resource that already exists",
  "domain": "kubernetes",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Helm is trying to create a resource (e.g., a Deployment or Service) that already exists in the cluster but is not managed by the current release, often due to a previous failed install or manual creation.",
  "root_cause_type": "generic",
  "root_cause_zh": "Helm 试图创建集群中已存在但不受当前版本管理的资源（例如 Deployment 或 Service），通常是由于之前的安装失败或手动创建。",
  "versions": [
    {
      "version": "helm 3.10.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "helm 3.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "helm 3.12.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kubernetes 1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "kubernetes 1.25",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Delete the resource manually and rerun helm upgrade.",
      "why_fails": "This may cause data loss or service disruption if the resource is critical; also, the resource might be managed by another Helm release, causing conflicts.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use `--force` flag with helm upgrade.",
      "why_fails": "The `--force` flag does not resolve ownership conflicts; it only forces pod restart. The error will persist.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use `helm list -a` to check for existing releases in the namespace. If the resource belongs to a different release, delete that release with `helm delete <release-name> --purge` (Helm 2) or `helm uninstall <release-name>` (Helm 3).",
      "success_rate": 0.85,
      "how": "Use `helm list -a` to check for existing releases in the namespace. If the resource belongs to a different release, delete that release with `helm delete <release-name> --purge` (Helm 2) or `helm uninstall <release-name>` (Helm 3).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Annotate the existing resource with the Helm release metadata to adopt it: `kubectl annotate <resource-type> <resource-name> meta.helm.sh/release-name=<release-name> meta.helm.sh/release-namespace=<namespace>`. Then retry the upgrade.",
      "success_rate": 0.75,
      "how": "Annotate the existing resource with the Helm release metadata to adopt it: `kubectl annotate <resource-type> <resource-name> meta.helm.sh/release-name=<release-name> meta.helm.sh/release-namespace=<namespace>`. Then retry the upgrade.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用 `helm list -a` 检查命名空间中的现有版本。如果资源属于其他版本，使用 `helm delete <release-name> --purge`（Helm 2）或 `helm uninstall <release-name>`（Helm 3）删除该版本。",
    "用 Helm 版本元数据注释现有资源以采用它：`kubectl annotate <resource-type> <resource-name> meta.helm.sh/release-name=<release-name> meta.helm.sh/release-namespace=<namespace>`。然后重试升级。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://helm.sh/docs/helm/helm_upgrade/",
  "official_doc_section": null,
  "error_code": "K8S-HELM-004",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}