Installation failed with chart dependency to Redis

10/8/2021

In my umbrella Helm chart, I defined a dependency to 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

At time of writing, the latest version is 6.2.6 (see https://bitnami.com/stack/redis/helm).

But when I execute helm dependency update my-project, Helm downloads version 6.2.0 instead of 6.2.6. When I try to install my chart, it fails: 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"] Without the dependency to Redis, my chart installs fine.

I also tried to point at that specific Redis version in chart.yaml, but then helm dependency list returns:

NAME    VERSION REPOSITORY                              STATUS
redis   6.2.6   https://charts.bitnami.com/bitnami      wrong version

I'm running Kubernetes in Docker Desktop on my laptop. The versions I'm using:

  • Helm version: 3.7.0-rc.2
  • K8s server: 1.21.2
  • K8s client: 1.21.4

When I install Redis independently using helm install my-release bitnami/redis, the installation succeeds.

How do I use Redis 6.2.6 as a dependency in my chart?

-- ngruson
kubernetes
kubernetes-helm
redis

1 Answer

10/8/2021

K8s version 1.21 have deployment latest API

Simple ref : https://stackoverflow.com/a/66164857/5525824

While the chart you are using the Older API you might need to some changes or use the latest chart for installation.

The latest deployment API version is : apps/v1

You can check your K8s cluster supported API using

for kind in `kubectl api-resources | tail +2 | awk '{ print $1 }'`; do kubectl explain $kind; done | grep -e "KIND:" -e "VERSION:"

output

KIND:     deployment
VERSION:  v1
KIND:     statefulset
VERSION:  v1

Or use simple command : kubectl api-versions

You should checkout this Bitnami Redis document : https://artifacthub.io/packages/helm/bitnami/redis

it updated a few days back and could work with minor changes of API only in your case.

If you check the stable Redis version helm chart : https://github.com/helm/charts/blob/master/stable/redis/templates/redis-master-statefulset.yaml

stateful API version : apiVersion: apps/v1

You change your Bitnami helm chart API using the : https://github.com/bitnami/charts/tree/master/bitnami/redis#common-parameters

You can change the API version at : https://github.com/bitnami/charts/blob/9f9d8aa887608e39aaab4ca1a80677605825b888/bitnami/redis/templates/master/statefulset.yaml#L2

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

Read more at : https://helm.sh/docs/topics/charts/#the-apiversion-field

Or : https://github.com/bitnami/charts/tree/master/bitnami/redis#to-1200

You have two option

  1. Either you change the helm chart edit it with latest stable API
  2. Downgrade the K8s cluster to 1.16 or 1.18 and use your OLD redis chart which is giving error with 1.21
-- Harsh Manvar
Source: StackOverflow