Difference between helm repo add vs helm install - kubernetes-helm

I have delved into the documentations of helm and still it is unclear what is the difference between the two. Here's what I understand so far
helm install -> install a helm chart
helm repo add -> add a repo from the internet

You can see Helm as a templating tool, which reads files from the templates directory, fills them with values from values.yaml, and deploys them into the Kubernetes cluster. These is all done by the helm install command. So, Helm install takes your chart and deploys it into the Kubernetes cluster.
One of the feature of Helm is helm package, which packages your chart into a single *.tgz file and then you can store it in the Helm registry. A lot of Helm charts are stored that way, you can look, e.g., into Artifact Hub. If you find a chart you'd like to install from the Helm registry, you can add that remote repo into your local Helm registry using helm repo add. Then, helm repo update downloads a Helm chart to your local registry. Downloading a repo just downloads the Helm chart into your local registry, but it does not deploy anything into the Kubernetes cluster. To do that, you need to use helm install.

Related

Helm chart failed to download

When trying to do a list on helm by below command I am able to see the list of charts currently deployed in GKE cluster
helm list --all-namespaces
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
abc-cd in-gke 1 2023-01-06 deployed cd-5.16.14 v2.5.5
However when trying to download , it's throwing download error
$ helm show chart cd-5.16.14
Error: failed to download "cd-5.16.14"
Also helm repo showing blank , not sure if this has any significance as I can already see the charts
$ helm repo list
Error: no repositories to show
helm list --all-namespaces shows the releases that are already installed in your k8s cluster, and helm show shows information about the chart.
"A Chart is a Helm package. It contains all of the resource definitions
necessary to run an application, tool, or service inside of a
Kubernetes cluster.
A Repository is the place where charts can be collected and shared.
A Release is an instance of a chart running in a Kubernetes cluster.
One chart can often be installed many times into the same cluster. And
each time it is installed, a new release is created."
- from Helm documentation
Now if you are getting no response from helm repo list means that you need to add local repositories, and then you may need to update them. To do that use:
helm repo add [NAME] [URL] [flags] To add a repository.
helm repo update [REPO1 [REPO2 ...]] [flags] To update the information on available charts locally from chart repositories.
If it didn't work for some reasons, you may try helm repo add with --force-update as recommended in different troubleshooting scenarios here: https://helm.sh/docs/faq/troubleshooting/
If it worked you would be able to run helm show REPO_NAME/CHART_NAME.
In case you lost access to the chart or its repository, or it was deployed from a local helm chart that was not published to an artifactory. You can get the rendered manifest with helm get manifest RELEASE, with your example's inputs it will be:
helm get manifest abc-cd --namespace in-gke
And this won't show your helm values to get that you can try with helm get values RELEASE_NAME [flags], which would be something like:
helm get values abc-cd --namespace in-gke --all
Also, if any of these commands fail add --debug or set HELM_DEBUG=1.
I hope this was helpful :)

install helm chart package without public container registry (offline,locally)

My problem is when i want to install a package in kubernetes cluster with helm chart, for example install gitlab with helm, during installation there is need to download docker image from a public registry and i don't access internet and i ran nexus repository in my local environment but in helm chart i can't set my local nexus docker image repository as a registry to helm and helm try to download docker image from internet not my local repository.
how can i set my local nexus repository as a primary docker registry for helm chart?
in helm chart this is difficult to change instruction of a ready to use helm chart, for example gitlab helm chart, and you can only download docker images independently and if PullPolicyImage set to IfNotPresent image does not download again.
you can change helm chart ready to use repo, to download images from you local repo with adding your local_registryIP:Port in front of a docker image address. but as i said this difficult for large helm chart like gitlab.

How to tell Helm which repo & chart is going to install?

I'm following Helm's document here to install a package, a.k.a. a helm chart:
$ helm install happy-panda stable/mariadb
It's really convenient to have a ready-to-use package. But in case of a package doesn't belong to stable repo, for example appmesh-grafana then I have to do more than this:
$ helm repo add aws https://aws.github.io/eks-charts
$ helm install aws/appmesh-grafana --version 0.1.0
Therefore, it forces me surf around the internet to find repo url, package name, etc. I don't want to do it every single time!
Is there any way to specify the repo and chart to install using Chart.yaml? I prefer Chart.yaml than shell script.
The short answer is no, if a chart is not in the official repo, then you always need to add the repository first before installing the chart.
However, starting from the Helm 3, you can look for the chart directly in the Helm Hub. In your case, if you wanted to find appmesh-grafana, you can execute the following command.
$ helm search hub appmesh-grafana
URL CHART VERSION APP VERSION DESCRIPTION
https://hub.helm.sh/charts/aws/appmesh-grafana 0.1.0 6.4.3 App Mesh Grafana Helm chart for Kubernetes
But then, yes, you need to open the link, find the address, and anyway execute $ helm repo add aws https://aws.github.io/eks-charts.

Helm v3 cannot find my charts in private repo

I have a private helm repo using apache, after migrating to helm3 I cannot install/search charts anymore.
Using helm v3
helm repo list
NAME URL
mas http://localhost:8080/charts/
helm search repo mas/devops-openshift
No results found
Using helm 2.*
helm search -r mas/devops-openshift
NAME CHART VERSION APP VERSION DESCRIPTION
mas/devops-openshift 7.0.0 Devops (OpenShift)
Same happens when using "helm install" command, it cannot find the charts.
I guess it could be something related to the helm repo index file. Maybe helmv3 is expecting a different structure? But same happen when generating index file from helmv3.
Thanks all for the answers but I've found the issue.
My repository were using development version of the charts so I had something like this 1.0.0-pre.dev (Semantic Versioning 2.0.0).
By default helm 3 does not look at non production charts.
You have to set the flag -devel. something like:
helm search repo mas/devops-openshift --devel
While migrating from helm 2 to helm 3 remove private repo and add it after migration, then run helm repo update to refresh repository file.
If the chart is available locally, run helm repo index <DIR> --url <your_repo_url> to create new index.yaml for this repository.
Running helm env will show you the directory where the repository.yamlis located so check if the file is generated correctly.

What format is custom Helm chart repository?

I am installing Kubernetes in a non-internet environment. I want to use Helm and want to set up a custom chart repository.
helm init barfs after creating ~/.helm/repository/repositories.yaml as it can't reach the default Google repo, so I will end up installing manually via kubectl - what is the format of this chart repository if I want to set up my own?
I will run helm init --dry-run --debug in order to get the manifest and amend this to point at a Docker registry that I have access to then install via kubectl.
I didn't see the section in the docs here: https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md
It's a web server.
A custom helm repository doesnt have to do anything with your kubernetes. Setting up the custom repo can be done without connecting even to any kubernetes cluster.
helm init --client-only
Next step is to set up your custom repository somewhere like a storage account or whatever, then add that custom repo Url to your helm. So far this is all client side; you didnt touch your cluster yet.
helm repo add <HELM-REPO-NAME> <HEM-REPO-URL>
The final step which is where you will need to connect to a real kubernetes cluster to install the helm chart using Tiller which lives inside your cluster.