kubernetes config_error ai_generated true

错误:升级失败:安装 CRD 失败:无法识别 "":在版本 "apiextensions.k8s.io/v1beta1" 中找不到类型 "CustomResourceDefinition"

Error: UPGRADE FAILED: failed to install CRD: unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"

ID: kubernetes/helm-upgrade-failed-api-version-removed

其他格式: JSON · Markdown 中文 · English
90%修复率
85%置信度
1证据数
2023-06-10首次发现

版本兼容性

版本状态引入弃用备注
Helm v3.12.0 active
Helm v3.13.0 active
Kubernetes v1.25.0 active
Kubernetes v1.28.0 active

根因分析

Helm chart 引用了旧版 API(v1beta1),该版本在 Kubernetes 1.22+ 中被移除,导致 CRD 安装失败。

English

The Helm chart references an old API version (v1beta1) that was removed in Kubernetes 1.22+, causing CRD installation to fail.

generic

官方文档

https://helm.sh/docs/topics/kubernetes_apis/#removed-apis

解决方案

  1. 更新 Helm chart 使用 apiextensions.k8s.io/v1:运行 `helm pull chart-name --untar`,编辑 CRD YAML 将 `apiVersion: apiextensions.k8s.io/v1beta1` 改为 `apiVersion: apiextensions.k8s.io/v1`,然后使用本地 chart 执行 `helm upgrade --install`。
  2. 使用更新版本的 chart:`helm repo update && helm upgrade my-release chart-name --version <新版本>`。
  3. 如果 chart 不再维护,使用 `kubectl convert` 或迁移工具(如 kubepug)手动转换 CRD。

无效尝试

常见但无效的做法:

  1. Downgrading the Kubernetes cluster to an older version to support v1beta1 95% 失败

    Downgrading a cluster is complex and risky; it's better to update the chart.

  2. Manually editing the cluster's API server flags to re-enable v1beta1 100% 失败

    The v1beta1 CRD API was fully removed in 1.22+; no flag can restore it.