What format is custom Helm chart repository? - kubernetes

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.

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 :)

Difference between helm repo add vs helm install

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.

Does K0s support Helm v.3?

I am trying to use helm charts with k0s.
Having my own helm-charts app, I would like to create a local repo. But I cannot use the serve command since I am using version: 3.5.4 and the serve command had been ditched for security concerns.
I am not sure now how to create a local repo ? and where can I find tutorials or examples ?
Also, how to deploy my chart in k0s cluster ?
I would try to use ChartMuseum instead. You can follow the docs to create a local filesystem chart.
You simply deploy the same way as with helm v2. Make sure you add the chart repo and you have kubectl configured to point to the cluster that you want to talk to so that ~/.kube/config has the right configuration.
Yes it does, you can also utilize k8slens.dev to easily deploy helm charts to your Kubernetes clusters. Regardless of the distro..

How to edit the Configurations of a Helm Chart?

Hi everyone,
I have deployed a Kubernetes cluster based on kubeadm and for the purpose of performing HorizontalPodAutoscaling based on the Custom Metrics, I have deployed prometheus-adpater through Helm.
Now, i want to edit the configuration for prometheus-adpater and because i am new to Helm, i don't know how to do this. So could you guid me how to edit the deployed helm charts?
I guess helm upgrade is that are you looking for.
This command upgrades a release to a specified version of a chart and/or updates chart values.
So if you have deployed prometheus-adapter, you can use command helm fetch
Download a chart from a repository and (optionally) unpack it in local directory
You will have all yamls, you can edit them and upgrade your current deployed chart via helm upgrade
I found an example, which should explain it to you more precisely.
You're trying to customize an installed chart. Please use this guide Customizing the Chart Before Installing.
The key parts:
There are two ways to pass configuration data during install:
--values (or -f): Specify a YAML file with overrides. This can be specified multiple times and the rightmost file will take precedence
--set name=value: Specify overrides on the command line
There are a couple more ways to customize a Helm Chart values:
You may create a file with defined config and then helm install my-app [chart] -f /path/to/myconfig.yaml
As an example for a config file, please refer, for example, to redis one.
The second one is to check for the files the helm repo add or helm repo update create. You may check with helm env the variable HELM_REPOSITORY_CACHE that shows where those files are.
Untar the chart and look for the values config file or even go to the Kubernetes manifests /templates for a more in-depth customization. Then, install the chart.

Helm export YAML files locally (just use templating engine, do not send to Kubernetes)

I want to export already templated Helm Charts as YAML files. I can not use Tiller on my Kubernetes Cluster at the moment, but still want to make use of Helm Charts. Basically, I want Helm to export the YAML that gets send to the Kubernetes API with values that have been templated by Helm. After that, I will upload the YAML files to my Kubernetes cluster.
I tried to run .\helm.exe install --debug --dry-run incubator\kafka but I get the error Error: Unauthorized.
Note that I run Helm on Windows (version helm-v2.9.1-windows-amd64).
We need logs to check the Unauthorized issue.
But you can easily generate templates locally:
helm template mychart
Render chart templates locally and display the output.
This does not require Tiller. However, any values that would normally
be looked up or retrieved in-cluster will be faked locally.
Additionally, none of the server-side testing of chart validity (e.g.
whether an API is supported) is done.
More info: https://helm.sh/docs/helm/helm_template/
Amrit Bera's solution will only work with local helm chart, per the details of your question you want it to work with remote helm chart, that's a feature that will be added to Helm v3 (Work in Progress currently).
RehanSaeed posted the following workaround (https://github.com/helm/helm/issues/4527)
Basically:
mkdir yamls
helm fetch --untar --untardir . 'stable/redis' #makes a directory called redis
helm template --output-dir './yamls' './redis' #redis dir (local helm chart), export to yamls dir
The good thing about this is you can mix this technique with weaveworks flux for git ops + this gives you another option for using Helm v2 without tiller, in addition to the Tiller Plugin (which lets you run tiller locally, but doesn't work smoothly).
Straight from the helm install --help
To check the generated manifests of a release without installing the chart,
the '--debug' and '--dry-run' flags can be combined. This will still require a
round-trip to the Tiller server.
If you want to see only the resolved YAML you can use
helm template .
I prefer to see it on a file
helm template . > solved.yaml
This is not the answer for the question but this post on stackoverflow
is the first one which was displayed in searchengines when i was
searching for a solution of my problem and solved it by myself reading
the Helm CLI docs. I post it here anyway because maybe someone else is
searching for the same usecase as i did.
For already installed Helm charts on a Kubernetes cluster you can use the following command to export/download all information for a named release:
helm get all <release-name>
or
helm get all <release-name> > installed-kubernetes-resources.yaml
If you only want e.g. the manifests or values instead of all, just replace the all command appropriately (get more details by using helm get --help):
Usage:
helm get [command]
Available Commands:
all download all information for a named release
hooks download all hooks for a named release
manifest download the manifest for a named release
notes download the notes for a named release
values download the values file for a named release
If you want to export the information for a named release with a distinct revision you can use the flag --revision int in your get command (helm get all --help). To list all possible revisions of your named release just use the command helm history <release-name>.
My Helm CLI version:
version.BuildInfo{Version:"v3.5.0", GitCommit:"32c22239423b3b4ba6706d450bd044baffdcf9e6", GitTreeState:"clean", GoVersion:"go1.15.6"}