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

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?

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

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.
Edit: I forgot to mention the best current workaround is to install the CRDs by hand. Then --dry-run will work. Helm v3 ignores CRDs that are already installed, so you can just leave them there once you're happy with your configuration and do the install for real.
Upgrading CRDs in Helm is a whole different (not yet resolved) issue.
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).
In case anyone comes looking and is confused that the above two chart names are not links: Both have been renamed, and one has moved.
They are now prometheus-community/kube-prometheus-stack (replaces stable/prometheus-operator) and bitnami/kube-prometheus respectively.

Related

Why helm chart cannot be install on Microk8s?

I am using microk8s to run Kubernetes on my Ubuntu server. I am using the helm v3 as my helm command.
This is the result of the helm version command:
version.BuildInfo{Version:"v3.9.2", GitCommit:"1addefbfe665c350f4daf868a9adc5600cc064fd", GitTreeState:"clean", GoVersion:"go1.17.12"}
I am trying to run this helm chart on this K8s instance:
apiVersion: v2
name: myTest
description: The test daemon (test) helm chart
type: application
version: 1.4.0
appVersion: v1.18.0
kubeVersion: ">= 1.19.0"
...
But I am getting this error:
INSTALLATION FAILED: chart requires kubeVersion: >= 1.19.0 which is incompatible with Kubernetes v1.19.15-34+c064bb32deff78
I tried different versions of Microk8s as 1.21, 1.24, and 1.19 but there is the same result.
I installed this service on minikube without any problem :(
According to the Semantic Versioning specification you have a pre-release version of Kubernetes. (This is possibly an issue in microk8s's release process.) The Helm documentation for the kubeVersion: field states that it depends on the Go github.com/Masterminds/semver package. Its documentation notes:
SemVer comparisons using constraints without a prerelease comparator will skip prerelease versions. For example, >=1.2.3 will skip prereleases when looking at a list of releases while >=1.2.3-0 will evaluate and find prereleases.
So setting in your Chart.yaml that you're willing to tolerate pre-release versions should address this:
kubeVersion: ">= 1.19.0-0" # adding a -0 on the end

dask-getway on K8s using helm3: Error: failed to install CRD crds/daskclusters.yaml

I'm following the instructions to setup Dask on K8s Cluster. I'm on MacOS, have K8s running on Docker Desktop, kubectl version 1.22.5 and helm version 3.8.0. After adding the repository, downloading default configuration, installing helm chart using command
RELEASE=my-dask-gateway
NAMESPACE=dask-gateway
VERSION=0.9.0
helm upgrade --install \
--namespace $NAMESPACE \
--version $VERSION \
--values path/to/your/config.yaml \
$RELEASE \
dask/dask-gateway
generates following output/error
"dask" already exists with the same configuration, skipping
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "dmwm-bigdata" chart repository
...Successfully got an update from the "dask" chart repository
Update Complete. ⎈Happy Helming!⎈
Release "my-dask-gateway" does not exist. Installing it now.
Error: failed to install CRD crds/daskclusters.yaml: unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
An older post suggests to either update the manifest or use older version of kubernetes. Does that mean dask is not compatible with recent versions of kubernetes?
Posting community wiki answer for better visibility:
This is fixed in the repo main. You could grab the CRDs from there, or wait for a release, which we are hoping to do soon. Otherwise, yes, you would need an older version of kubernetes for dask-gateway to work.

Integrating GPU Telemetry into Kubernetes

https://docs.nvidia.com/datacenter/cloud-native/kubernetes/dcgme2e.html
helm install \
--generate-name
gpu-helm-charts/dcgm-exporter
Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
I using helm version: 3.5.2
Kubernetes Cluster: 1.19.5
Thanks in advance.
Apparently your Custom Resource Definition creation has finished successfully but its API was not yet available when the installation proceeded with creation of the ServiceMonitor Custom Resource. Running helm install ... command once again should help.

How to upgrade helm from 2 to 3 version in jenkinsx installed in okd environment

I want to upgrade helm version from 2 version to 3 version since I am facing "Could not find tiller" issue in while using "helm delete --purge " in JenkinsX.
So upgrade does not depend on tiller and makes my job easy. Please help me to resolve this.
jx step helm build
WARNING: No $CHART_REPOSITORY defined so using the default value of: http://jenkins-x-chartmuseum:8080
Adding missing Helm repo: storage.googleapis.com https://storage.googleapis.com/chartmuseum.jenkins-x.io
Successfully added Helm repository storage.googleapis.com.
Adding missing Helm repo: jenkins-x-chartmuseum http://jenkins-x-chartmuseum:8080
Successfully added Helm repository jenkins-x-chartmuseum.
WARNING: No $CHART_REPOSITORY defined so using the default value of: http://jenkins-x-chartmuseum:8080
Adding missing Helm repo: chartmuseum.jenkins-x.io http://chartmuseum.jenkins-x.io
Successfully added Helm repository chartmuseum.jenkins-x.io.
EXITCODE 0[Pipeline] sh
[preview] Running shell script
+ make delete
helm version
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Error: could not find tiller
use the command choco upgrade kubernetes-helm
first install chococo/brew then use above for choco cmd or brew upgrade helm.
The latest Helm 3 won't need tiller pod.

Helm install unknown flag --name

When I try to install a chart with helm:
helm install stable/nginx-ingress --name my-nginx
I get the error:
Error: unknown flag: --name
But I see the above command format in many documentations.
Version:
version.BuildInfo{Version:"v3.0.0-beta.3",
GitCommit:"5cb923eecbe80d1ad76399aee234717c11931d9a",
GitTreeState:"clean", GoVersion:"go1.12.9"}
Platform: Windows 10 64
What could be the reason?
In Helm v3, the release name is now mandatory as part of the commmand, see helm install --help:
Usage:
helm install [NAME] [CHART] [flags]
Your command should be:
helm install my-nginx stable/nginx-ingress
Furthermore, Helm will not auto-generate names for releases anymore. If you want the "old behavior", you can use the --generate-name flag. e.g:
helm install --generate-name stable/nginx-ingress
The v3 docs are available at https://v3.helm.sh/docs/, but as it is a beta version, the docs will not be accurate for a while. It's better to rely on the CLI --help, that is auto-generated by Go/Cobra.
The --name flag is no more in version 3.
It should be
helm install my-nginx stable/nginx-ingress
Syntax:
help install [name] [chart]
I don't think the helm3 does support "--name" argument. As per the helm3 doc, the command to install a package and expected output is given down below:
$ helm install happy-panda bitnami/wordpress
NAME: happy-panda
LAST DEPLOYED: Tue Jan 26 10:27:17 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
** Please be patient while the chart is being deployed **
Here "happy-panda" is the name of the release and "bitnami/wordpress" is the name of the chart. Also you can generate name for the release by using
--generate-name flag.
As others have mentioned, there is no --name flag in version 3 of Helm. Also, Helm v3 comes without stable repository setup by default. The best way to discover a chart by searching the Artifact Hub. Once you find the repo, which hosts the chart you are looking for, you need to add the repo as:
helm repo add nginx-stable https://helm.nginx.com/stable
And then you can install chart
helm install my-nginx nginx-stable/nginx-ingress
As name was made compulsory in helm3,
if we do helm repo --help,
help install [name] [chart]
If the chart was not present,
use helm repo add <name> <url>
then use helm install