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

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.

Related

helm: found in Chart.yaml, but missing in charts/ directory: postgresql,

I try to follow the kubernetes install README of ReportPortal
guettli#yoga15:~/projects/reportportal-kubernetes/reportportal$ mv v5 reportportal
guettli#yoga15:~/projects/reportportal-kubernetes/reportportal$ helm install ./reportportal
Error: must either provide a name or specify --generate-name
guettli#yoga15:~/projects/reportportal-kubernetes/reportportal$ helm install ./reportportal --generate-name
Error: found in Chart.yaml, but missing in charts/ directory: postgresql, rabbitmq-ha, elasticsearch, minio
Here is the v5 directory.
What needs to be done now?
I found the solution:
cd reportportal
helm dependency update
Adding a bit of a background.
Chart dependencies that are specified in the Chart.yaml should be download to disk before executing the installation of the parent chart.
This is done by helm dependency update which verifies that the required charts, as expressed in Chart.yaml, are present in charts/ and are at an acceptable version.
It will pull down the latest charts that satisfy the dependencies, and clean up old dependencies.

How to find the chart version of subcharts from a released helm chart?

I have installed a helm chart with subcharts and I want to find out which version of the subchart is installed. Is there any possible way in helm 3?
Following official Helm documentation:
Helm.sh: Subcharts and globals
Helm.sh: Charts
Helm.sh: Helm dependency
You can get the version of a subchart used by a chart by following below example:
Download the chart with $ helm pull repo/name --untar
Go inside the chart directory
Invoke command: $ helm dependency list
You can get a message that there are no dependencies:
WARNING: no dependencies at gce-ingress/charts
You can also get a message with dependencies and their versions:
NAME VERSION REPOSITORY STATUS
kube-state-metrics 2.7.* https://kubernetes-charts.storage.googleapis.com/ unpacked
Additionally you can check the content of the prometheus/charts/kube-state-metrics/Chart.yaml for additional information.
Please let me know if that helped you.

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

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.

Helm Cannot Read Chart.yaml

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!