Helm 3.0.2 dry-run + stable/prometheus-operator? Is this supposed to work?

落爺英雄遲暮 提交于 2020-04-14 06:09:13

问题


With Helm v3.0.2 + a new Kubernetes v1.14.9 cluster.

fyi, I've already added the stable repo:

helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm install \
  --namespace prometheus \
  prom-dry-run \
  stable/prometheus-operator \
  --dry-run

manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
manifest_sorter.go:175: info: skipping unknown hook: "crd-install"
Error: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "Alertmanager" in version "monitoring.coreos.com/v1", unable to recognize "": no matches for kind "Prometheus" in version "monitoring.coreos.com/v1", unable to recognize "": no matches for kind "PrometheusRule" in version "monitoring.coreos.com/v1", unable to recognize "": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"]

I thought Helm 3 was backward-compatible with existing charts? Is this an exception?

Is prometheus-operator not compatible with Helm 3? Do I have to use Helm 2? Or is there a backward-compatibility option?


回答1:


CRDs were an exception to the Helm v3 chart compatibility, sadly.

The problem is that --dry-run can't generate resources using the CRDs, because the CRDs aren't installed by the dry run. This is apparently a "documented behaviour" although it was documented in the implementation pull-request, not in the Helm Documentation.


stable/prometheus-operator gained support to Helm v3 in 8.2.0 in mid-November 2019 so that's not the issue here.

bitnami/prometheus-operator gained support in 0.3.0 only a couple of days earlier.

Both appear to be actively maintained at the time of writing (March 2020).




回答2:


The stable repo is scheduled to be deprecated and probably not updated with latest charts.The canonical source for Helm charts is the Helm Hub. Use below command to add repo and install prometheus operator from Helm Hub using helm 3 or helm 2.

helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-prom-release bitnami/prometheus-operator

There is a detailed guide for migrating from helm 2 to helm 3

In helm 3 during a dry run, CRDs are not installed but the Kubernetes validation happens against the output of the chart. So any CR that uses a CRD that is installed by the chart will fail validation during dry run.

Current work-arounds:

1.Use helm template instead of dry run

2.Don't reference CRs in the same chart that has the CRDs

3.Install the CRD separately before running the dry run



来源:https://stackoverflow.com/questions/59539621/helm-3-0-2-dry-run-stable-prometheus-operator-is-this-supposed-to-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!