安装失败,图表依赖于 Redis
Installation failed with chart dependency to Redis
在我的 umbrella Helm 图表中,我定义了对 Redis 的依赖:
apiVersion: v2
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: my-project
version: 0.1.0
dependencies:
- name: redis
version: ~6.2.x
repository: https://charts.bitnami.com/bitnami
撰写本文时,最新版本为 6.2.6(请参阅 https://bitnami.com/stack/redis/helm)。
但是当我执行 helm dependency update my-project
时,Helm 下载版本 6.2.0 而不是 6.2.6。
当我尝试安装我的图表时,它失败了:
Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1", unable to recognize "": no matches for kind "StatefulSet" in version "apps/v1beta2"]
没有对 Redis 的依赖,我的图表安装正常。
我也试图在 chart.yaml 中指出那个特定的 Redis 版本,但是 helm dependency list
returns:
NAME VERSION REPOSITORY STATUS
redis 6.2.6 https://charts.bitnami.com/bitnami wrong version
我是 运行 Kubernetes 在 Docker 桌面上,在我的笔记本电脑上。
我使用的版本:
- 头盔版本:3.7.0-rc.2
- K8s 服务器:1.21.2
- K8s客户端:1.21.4
当我使用helm install my-release bitnami/redis
独立安装Redis时,安装成功
如何在图表中使用 Redis 6.2.6 作为依赖项?
K8s 版本 1.21 部署最新 API
简单参考:
虽然您使用的是较旧的图表 API 您可能需要进行一些更改或使用最新的图表进行安装。
最新部署API版本为:apps/v1
您可以使用
检查您的 K8s 集群支持 API
for kind in `kubectl api-resources | tail +2 | awk '{ print }'`; do kubectl explain $kind; done | grep -e "KIND:" -e "VERSION:"
输出
KIND: deployment
VERSION: v1
KIND: statefulset
VERSION: v1
或者使用简单的命令:kubectl api-versions
你应该查看这个 Bitnami Redis 文档:https://artifacthub.io/packages/helm/bitnami/redis
它在几天前更新了,并且可以对 API 进行微小的更改,仅适用于您的情况。
如果你查看稳定的 Redis 版本 helm 图表:https://github.com/helm/charts/blob/master/stable/redis/templates/redis-master-statefulset.yaml
有状态 API 版本:apiVersion: apps/v1
您使用 https://github.com/bitnami/charts/tree/master/bitnami/redis#common-parameters
更改您的 Bitnami helm chart API
Previous versions of this Helm Chart use apiVersion: v1 (installable
by both Helm 2 and 3), this Helm Chart was updated to apiVersion: v2
(installable by Helm 3 only). Here you can find more information about
the apiVersion field. The different fields present in the Chart.yaml
file has been ordered alphabetically in a homogeneous way for all the
Bitnami Helm Charts
阅读更多信息:https://helm.sh/docs/topics/charts/#the-apiversion-field
或:https://github.com/bitnami/charts/tree/master/bitnami/redis#to-1200
你有两个选择
- 要么你改变 helm chart 用最新的稳定版编辑它 API
- 将 K8s 集群降级到 1.16 或 1.18 并使用你的 OLD redis 图表,它给出了 1.21 的错误
在我的 umbrella Helm 图表中,我定义了对 Redis 的依赖:
apiVersion: v2
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: my-project
version: 0.1.0
dependencies:
- name: redis
version: ~6.2.x
repository: https://charts.bitnami.com/bitnami
撰写本文时,最新版本为 6.2.6(请参阅 https://bitnami.com/stack/redis/helm)。
但是当我执行 helm dependency update my-project
时,Helm 下载版本 6.2.0 而不是 6.2.6。
当我尝试安装我的图表时,它失败了:
Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1", unable to recognize "": no matches for kind "StatefulSet" in version "apps/v1beta2"]
没有对 Redis 的依赖,我的图表安装正常。
我也试图在 chart.yaml 中指出那个特定的 Redis 版本,但是 helm dependency list
returns:
NAME VERSION REPOSITORY STATUS
redis 6.2.6 https://charts.bitnami.com/bitnami wrong version
我是 运行 Kubernetes 在 Docker 桌面上,在我的笔记本电脑上。 我使用的版本:
- 头盔版本:3.7.0-rc.2
- K8s 服务器:1.21.2
- K8s客户端:1.21.4
当我使用helm install my-release bitnami/redis
独立安装Redis时,安装成功
如何在图表中使用 Redis 6.2.6 作为依赖项?
K8s 版本 1.21 部署最新 API
简单参考:
虽然您使用的是较旧的图表 API 您可能需要进行一些更改或使用最新的图表进行安装。
最新部署API版本为:apps/v1
您可以使用
检查您的 K8s 集群支持 APIfor kind in `kubectl api-resources | tail +2 | awk '{ print }'`; do kubectl explain $kind; done | grep -e "KIND:" -e "VERSION:"
输出
KIND: deployment
VERSION: v1
KIND: statefulset
VERSION: v1
或者使用简单的命令:kubectl api-versions
你应该查看这个 Bitnami Redis 文档:https://artifacthub.io/packages/helm/bitnami/redis
它在几天前更新了,并且可以对 API 进行微小的更改,仅适用于您的情况。
如果你查看稳定的 Redis 版本 helm 图表:https://github.com/helm/charts/blob/master/stable/redis/templates/redis-master-statefulset.yaml
有状态 API 版本:apiVersion: apps/v1
您使用 https://github.com/bitnami/charts/tree/master/bitnami/redis#common-parameters
更改您的 Bitnami helm chart APIPrevious versions of this Helm Chart use apiVersion: v1 (installable by both Helm 2 and 3), this Helm Chart was updated to apiVersion: v2 (installable by Helm 3 only). Here you can find more information about the apiVersion field. The different fields present in the Chart.yaml file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts
阅读更多信息:https://helm.sh/docs/topics/charts/#the-apiversion-field
或:https://github.com/bitnami/charts/tree/master/bitnami/redis#to-1200
你有两个选择
- 要么你改变 helm chart 用最新的稳定版编辑它 API
- 将 K8s 集群降级到 1.16 或 1.18 并使用你的 OLD redis 图表,它给出了 1.21 的错误