Helm Cannot Read Chart.yaml - kubernetes

I am trying to deploy Apache Nifi on Kubernetes using helm but when I execute this command:
helm install --name test-nifi --namespace nifi ./apache-nifi-helm
I immediately get an error saying:
Error: cannot read Chart.Yaml in directory "/home/mydir/test/apache-nifi"
And I have checked the directory and it certainly contains the Chart.Yaml file. I have cloned it from a GitHub Repo.
Am I making a mistake somewhere? Any help is greatly appreciated.

You can
Clone repo:
$ git clone git#github.com:markap14/apache-nifi-helm.git
Run helm:
$ helm install --name test-nifi --namespace ${YOU_NAMESPACE} ./apache-nifi-helm/charts/zookeeper-0.4.2.tgz --tiller-namespace ${YOU_NAMESPACE}

I've also been getting the
"cannot read Chart.Yaml in directory XYZ" error
from helm install in spite of the presence of a Chart.yaml file in the directory.
In the end it was other configuration problems (I had template in the 'charts' folder).
Hooray for the friendly error message!

Related

Helm looks in a different repository then the one I specify with a --repo flag

If I perform the following command it looks in "https://github.com/grafana/" instead of the one I specified - "https://grafana.github.io/helm-charts"
Here is what I run and the results:
helm3 upgrade --install grafana grafana --dry-run --repo https://grafana.github.io/helm-charts --wait
Release "grafana" does not exist. Installing it now.
Error: failed to download "https://github.com/grafana/helm-charts/releases/download/grafana-6.16.14/grafana-6.16.14.tgz"
Why is it looking in "github.com/grafana" instead of where I told it to look with the repo flag - "grafana.github.io"?
My co worker runs the same command and it works.
I list the repositories and grafana is not there so I would assume that would force this to work?
helm3 repo list
NAME URL
stable https://charts.helm.sh/stable
local http://127.0.0.1:8879/charts
eks https://aws.github.io/eks-charts
bitnami https://charts.bitnami.com/bitnami
cluster-autoscaler https://kubernetes.github.io/autoscaler
kube-dns-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
cluster-proportional-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
external-dns https://charts.bitnami.com/bitnami
kube2iam https://jtblin.github.io/kube2iam/
kubernetes-dashboard https://kubernetes.github.io/dashboard/
incubator https://charts.helm.sh/incubator
My coworker has the same repo list output as above.
The below commands will work in my system however I want to know why for me it will not work when I use the --repo flag as in the above example (all of our code has that flag in it and they do not want to change it) :
helm3 repo add grafana https://grafana.github.io/helm-charts
"grafana" has been added to your repositories
kconfig_et helm3 upgrade --install grafana grafana/grafana --dry-run --wait
I executed your Helm command but with --debug flag to get this error:
helm upgrade --install grafana grafana --dry-run --repo https://grafana.github.io/helm-charts --wait --debug
history.go:56: [debug] getting history for release grafana
Release "grafana" does not exist. Installing it now.
install.go:178: [debug] Original chart version: ""
Error: no cached repo found. (try 'helm repo update')
Then I simply executed helm repo update as suggested. I then retried the same helm upgrade command and it successfully installed the chart.
You coworker did not encounter the error because at some point he/she has executed helm repo update at least once. (Mine was a freshly installed Helm)
I solved it - I added "--debug" to the command and saw this -
Error: no cached repo found. (try 'helm repo update'): open /Users/mysystem/Library/Caches/helm/repository/local-index.yaml: no such file or directory
I next copied the one in .helm over to the location in the debug message -
cp ~/.helm/repository/local/index.yaml /Users/mysystem/Library/Caches/helm/repository/local-index.yaml
All worked after this!

Error: found in Chart.yaml, but missing in charts/ directory: elasticsearch, kibana, filebeat, logstash

I would like to deploy elastic-stack into Kubernetes cluster. I git clone the chart, use default settings. But, I got errors.
git clone https://github.com/helm/charts
Create namespace
kubectl create namespace elastic-stack
At $HOME/charts
$ helm install elastic-stack stable/elastic-stack --namespace=elastic-stack
Error: found in Chart.yaml, but missing in charts/ directory: elasticsearch, kibana, filebeat, logstash, fluentd, fluent-bit, fluentd-elasticsearch, nginx-ldapauth-proxy, elasticsearch-curator, elasticsearch-exporter
helm version
version.BuildInfo{Version:"v3.3.0-rc.1"
Have you enabled the stable repo for helm ? you can check this by running helm repo list
If not, please add using helm repo add stable https://charts.helm.sh/stable

Error: validation: chart.metadata is required when using helm install Traefik

I am now install Traefik using helm(version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}),follow this doc:
git clone https://github.com/containous/traefik-helm-chart
helm install ./traefik-helm-chart
give me this error:
Error: must either provide a name or specify --generate-name
and I am using command like this:
helm install ./traefik-helm-chart --generate-name
and give this tips:
Error: validation: chart.metadata is required
what should I do to fix this?
You need to give the exact path where the Chart.yaml file is located
helm2
helm install --name <release-name> <chart-path>
(e.g., helm install --name prometheus ./prometheus/)
helm3
helm3 install <release-name> <chart-path>
(e.g., helm3 install prometheus .)
helm3 install --generate-name <chart-path>
For anyone else getting to this page by googling the error message (like I did).
I received this same error because my custom chart file was called "chart.yaml" instead of "Chart.yaml" (note the uppercase C)
I received this error message because my only chart was in the directory "charts" rather than "templates"
This is what is expected:
.
├── [1.1K] Chart.yaml
├── [ 64] charts
└── [2.9K] templates
└── [2.8K] manifest.yaml
I got the error because Chart.yaml was being matched by a rule in .helmignore.
I got this error as I had removed version key from chart.yaml by mistake.

does helm have feature of print?

As we knew, helm charts are made by templates with variables and reference values from values.yml. I'd like to review the final heml chart, but there is no print or output feature.
For example, in serverless framework, I can run sls print to get the final serverless.yml
But I can't find the similar command in heml, such as
helm print <chart_name> -f values.yml
Make use of --debug and --dry-run option.
helm install ./mychart --debug --dry-run
Quoting statement from this official doc.
When you want to test the template rendering, but not actually install
anything, you can use helm install ./mychart --debug --dry-run. This
will send the chart to the Tiller server, which will render the
templates. But instead of installing the chart, it will return the
rendered template to you so you can see the output.
There is another way to do this without need of connection to tiller.
helm template ./mychart
Hope this helps.
Update:
Printing rendered contents of one of the stable chart (in my case airflow stable chart) would look like:
Using --debug and --dry-run option
helm install --namespace "airflow" --name "airflow" stable/airflow --debug --dry-run -f values.yaml
Using helm template
helm fetch stable/airflow
tar -xvf airflow-4.0.8.tgz
helm template --namespace "airflow" --name "airflow" ./airflow -f airflow/values.yaml
updates
Somehow, directly run helm template ./mychart doesn't work any more with below error.
For example,
$ git clone git#github.com:helm/charts.git
$ cd charts/stable/datadog
$ helm template .
Error: found in Chart.yaml, but missing in charts/ directory: kube-state-metrics
There are two new files in this folders
requirements.yaml
requirements.lock
they both mentioned a repository called https://kubernetes-charts.storage.googleapis.com/
So we need add it in helm
helm repo add common https://kubernetes-charts-incubator.storage.googleapis.com/
helm dependency update
helm template .
Now everything works as normal.
For your reference, my current helm version is v3.2.1.

Kubernetes Helm Chart Won't Update

Delete the cached archive to force a redownload:
rm -rf ~/.helm/cache/archive/cp-helm-charts-0.1.0.tgz
Do an explicit repo update
helm repo update
Do a debug/dry-run install to force a download:
helm install --debug --dry-run confluent/cp-helm-charts > /dev/null
Look at the specific file in the .tgz archive where I want to see the fix:
tar xfO ~/.helm/cache/archive/cp-helm-charts-0.1.0.tgz cp-helm-charts/charts/cp-kafka/templates/statefulset.yaml | grep -n -C10 volumes:
Compare to the latest version on github, which was modified 8 days ago:
https://github.com/confluentinc/cp-helm-charts/blob/master/charts/cp-kafka/templates/statefulset.yaml#L140
The github version has - name: datadir-0. The version Helm pulls just has - name: datadir without the trailing -0.
Why does the .tgz file that Helm pulls not have the latest fix in the master branch version on github? How do I fix this?
FYI, my relevant environment information:
helm version
Client: &version.Version{SemVer:"v2.12.2", GitCommit:"7d2b0c73d734f6586ed222a567c5d103fed435be", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.12.2", GitCommit:"7d2b0c73d734f6586ed222a567c5d103fed435be", GitTreeState:"clean"}
helm repo list
NAME URL
stable https://kubernetes-charts.storage.googleapis.com
local http://127.0.0.1:8879/charts
confluent https://confluentinc.github.io/cp-helm-charts/
The chart maintainer is distributing a .tgz chart that is not up to date with recent git commits. They recommend you build your own chart .tgz.