Add Helm Hub as a remote repository on Artifactory - kubernetes

I have been serving Helm Stable as a remote repository in Artifactory for a few months now with no issue, however one of the charts I use has recently moved on to Helm hub. Try as I may, I cannot seem to get Artifactory to recognise this as a remote repo.I have tried adding both https://hub.helm.sh/ and https://charts.jetstack.io (The chart in question is Jetstack's cert-manager) to no avail. It just shows up as empty in Artifactory.
Does anyone have any experience getting Artifactory remote repos working with Helm Hub?

In Artifactory, to create a remote Helm repository for https://charts.jetstack.io content, "Bypass HEAD Requests" in the advanced settings must be enabled. This is because Artifactory first makes a HEAD request for /index.yaml, to which charts.jetstack.io responds with a 404:
$ curl -siXHEAD https://charts.jetstack.io/index.yaml
HTTP/1.1 404 Not Found
Server: nginx/1.15.6
...

You need to add jetstack repo with below command.
helm repo add jetstack https://charts.jetstack.io
if this helm repo is already added, we can update with
helm update
then if you run helm search jetstack you'll find your chart as below:
NAME CHART VERSION APP VERSION DESCRIPTION
jetstack/cert-manager v0.7.0 v0.7.0 A Helm chart for cert-manager
jetstack/tor-proxy 0.1.1 A Helm chart for Kubernetes
Note
For successful deployment, you should install CRDs before helm install
kubectl apply \
-f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.7/deploy/manifests/00-crds.yaml
If you're installing helm chart in some XX namespace which is already existed, you should label this XX namespace with certmanager.k8s.io/disable-validation="true"
kubectl label namespace XX certmanager.k8s.io/disable-validation="true"
Last
to install run below command
helm install --name my-release --namespace XX jetstack/cert-manager

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

K8s: how to install charts from the Helm Hub

Disclaimer: I'm new to Kubernetes and Helm.
I am trying to install a Helm chart using the brand new Helm Hub and for the life of me I can't figure out how this is supposed to work.
A new version of Helm (3.0) was released only a few months ago with significant changes, one of them is that it doesn't come with any repositories configured. Helm released the Helm Hub which is supposed to be a centralized service to find charts.
I am trying to install a CloudBees Jenkins chart. This is what I get when I search the hub:
[me#localhost tmp]$ helm search hub cloudbees -o yaml
- app_version: 2.222.1.1
description: The Continuous Delivery Solution for Enterprises
url: https://hub.helm.sh/charts/cloudbees/cloudbees-core
version: 3.12.0+80c17a044bc4
- app_version: 9.2.0.139827
description: A Helm chart for CloudBees Flow
url: https://hub.helm.sh/charts/cloudbees/cloudbees-flow
version: 1.1.1
- app_version: 9.2.0.139827
description: A Helm chart for CloudBees Flow Agent
url: https://hub.helm.sh/charts/cloudbees/cloudbees-flow-agent
version: 1.1.1
- app_version: 2.204.3.7
description: CloudBees Jenkins Distribution provides development teams with a highly
dependable, secure, Jenkins environment curated from the most recent supported
Jenkins release. The distribution comes with a recommended catalog of tested plugins
available through the CloudBees Assurance Program.
url: https://hub.helm.sh/charts/cloudbees/cloudbees-jenkins-distribution
version: 2.204.307
- app_version: 2.0.2
description: Helm chart for sidecar injector webhook deployment
url: https://hub.helm.sh/charts/cloudbees/cloudbees-sidecar-injector
version: 2.0.2
So it looks like the chart I am looking for is available: cloudbees-jenkins-distribution.
However, I can't find any way to install from the hub or to add a repository based on the hub output. Some of the things I've tried:
[me#localhost tmp]$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "incubator" chart repository
...Successfully got an update from the "gitlab" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈
[me#localhost tmp]$ helm install myJenkins cloudbees-jenkins-distribution
Error: failed to download "cloudbees-jenkins-distribution" (hint: running `helm repo update` may help)
[me#localhost tmp]$ helm repo add cbRepo https://hub.helm.sh/charts/cloudbees
Error: looks like "https://hub.helm.sh/charts/cloudbees" is not a valid chart repository or cannot be reached: error converting YAML to JSON: yaml: line 8: mapping values are not allowed in this context
[me#localhost tmp]$ helm repo add cbRepo https://hub.helm.sh/charts/cloudbees/cloudbees-jenkins-distribution
Error: looks like "https://hub.helm.sh/charts/cloudbees/cloudbees-jenkins-distribution" is not a valid chart repository or cannot be reached: error converting YAML to JSON: yaml: line 8: mapping values are not allowed in this context
The documentation really doesn't say much about how I'm supposed to go from the Helm Hub to an installed chart. What am I missing here?
Helm Hub is NOT like a repo that you can add and install from it helm charts. It doesn't expose valid repos urls either. That's why you're getting the error message like below:
Error: looks like "https://hub.helm.sh/charts/cloudbees" is not a valid chart repository ...
when you're trying to run helm repo add on https://hub.helm.sh based urls.
I know it may seem pretty confusing but it just works like that, by its very design. Please refer to this discussion on Github. Specifically this comment explains it a bit more and I hope it also answers your question:
hub.helm.sh is not the helm repo, so it will not work the you trying,
it is only meant to view and search for charts. check in there for
chart repository and it that way, then you will be able to install the
charts.
Unfortunatelly the official helm documentation doesn't explain it well enough. It mentions only:
helm search hub searches the Helm Hub, which comprises helm charts
from dozens of different repositories.
But it shows "no explanation how to get from helm search repo which shows hub.helm.sh to helm repo add which magically shows the a new url to use." - as one user wrote in the thread mentioned above.
Despite that Helm hub doesn't have a convenient way to get a repository url, it has a github repo that contains all vendors repository in one file.
We can use that fact to create a workaround, that you can improve using automation tools like bash,awk, sed, perl, python, etc.
Let's imagine we want to get the helm chart url using helm v3 and command line tools only.
(helm3 is just a symlink for helm v3.1.2)
Let's get the repository name for jenkins distribution for cloudbees vendor
$ helm3 search hub jenkins --max-col-width 1000 | grep cloudbees | tr "\t" "\n"
https://hub.helm.sh/charts/cloudbees/cloudbees-core
3.12.0+80c17a044bc4
2.222.1.1
The Continuous Delivery Solution for Enterprises
https://hub.helm.sh/charts/cloudbees/cloudbees-jenkins-distribution
2.204.307
2.204.3.7
CloudBees Jenkins Distribution provides development teams with a highly dependable, secure, Jenkins environment curated from the most recent supported Jenkins
release. The distribution comes with a recommended catalog of tested plugins available through the CloudBees Assurance Program.
As we can see the chart page on Helm hub is
# https://hub.helm.sh/charts/cloudbees/cloudbees-jenkins-distribution
# ^^^^^^^^^
so we can assume that repository name is also cloudbees
Let's find the url for cloudbees helm repository
$ curl -s https://raw.githubusercontent.com/helm/hub/master/config/repo-values.yaml | grep cloudbees
- name: cloudbees
url: https://charts.cloudbees.com/public/cloudbees
Now we can add this repository using helm repo command:
$ helm3 repo add cloudbees https://charts.cloudbees.com/public/cloudbees
"cloudbees" has been added to your repositories
Don't forget to update:
$ helm3 repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "cloudbees" chart repository
Update Complete. ⎈ Happy Helming!⎈
To find the chart name let's repeat search in repo
$ helm3 search repo jenkins
NAME CHART VERSION APP VERSION DESCRIPTION
cloudbees/cloudbees-jenkins-distribution 2.204.307 2.204.3.7 CloudBees Jenkins Distribution provides develop...
cloudbees/cloudbees-core 3.12.0+80c17a044bc4 2.222.1.1 The Continuous Delivery Solution for Enterprises
And finally we can install the chart:
$ helm3 install cloudbees/cloudbees-jenkins-distribution --version 2.204.307
Happy Helming3 ! :)
True, helm search hub cloudbees does not return the url of the repo.
What you can do from the result of helm search hub cloudbees is helm install $urlFromBefore:
$ helm search hub cloudbees
- app_version: 2.222.1.1
description: The Continuous Delivery Solution for Enterprises
url: https://hub.helm.sh/charts/cloudbees/cloudbees-core
...
$ helm install cloudbees https://hub.helm.sh/charts/cloudbees/cloudbees-core
from helm/helm#7419
To get the repo url, you can do the search on https://hub.helm.sh or
do a work around when you want the repo url from console:
$ curl https://hub.helm.sh/api/chartsvc/v1/charts/search?q=rancher | json_pp
The repo url is in key url in repo (data[...].attributes.repo.url).
(json_pp is optional. It pretty prints json, which helps me to read it.)
Now continue with
# variables names show the place in json output from above
helm repo add $data_attributes_repo_name $data_attributes_repo_url
helm repo update
helm install $data_attributes_repo_name/$data_attributes_name

How to download chart package from Helm ChartMuseum?

I feel I have overseen something but I'm unable to find the appropriate section on https://github.com/helm/chartmuseum
How can I download helm chart package (.tgz) from Helm ChartMuseum (using curl, wget or any other cli)?
Helm must use that API to download requirements, but somehow I can't find the information in the ChartMuseum readme...
Using helm v3:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm repo update
helm pull stable/chartmuseum --untar # optionally untar
Get it with curl:
curl https://kubernetes-charts.storage.googleapis.com/chartmuseum-2.5.0.tgz --output chartmuseum-2.5.0.tgz
All the packages from stable repo are here:
https://kubernetes-charts.storage.googleapis.com/
The latest version of chartmuseum to date is here:
https://kubernetes-charts.storage.googleapis.com/chartmuseum-2.5.0.tgz
The helm chart of chart museum on GitHub:
https://github.com/helm/charts/tree/master/stable/chartmuseum

Docker for windows kubernetes helm - add public repo and get mailhog

I am using Windows 10 with docker for windows.
I have acitve kubernetes.
I've downloaded helm from https://github.com/helm/helm/releases and added files to Windows PATH.
Now i want to execute:
helm install stable/mailhog --generate-name
but i get
Error: failed to download "stable/mailhog" (hint: running 'helm repo update' may help
I am not sure how to add public repo for it.
I tried adding it with:
helm repo add mailhog https://kubernetes-charts-incubator.storage.googleapis.com/
"mailhog" has been added to your repositories
helm repo update
but the output from helm install stable/mailhog --generate-name gives me still the same error.
How can i get stable/mailhog this way?
Using https://kubernetes-charts.storage.googleapis.com as the helm repo works for me:
helm init
helm repo add stable https://kubernetes-charts.storage.googleapis.com
$ helm repo list
NAME URL
stable https://kubernetes-charts.storage.googleapis.com
helm install stable/mailhog --generate-name

Helm V3 - Cannot find the official repo

I have been trying to install nginx ingress using helm version 3
helm install my-ingress stable/nginx-ingress
But Helm doesn't seem to be able to find it's official stable repo. It gives the message:
Error: failed to download "stable/nginx-ingress" (hint: running helm
repo update may help)
I tried helm repo update. But it doesn't help.
I tried listing the repos helm repo list but it is empty.
I tried to add the stable repo:
helm repo add stable https://github.com/helm/charts/tree/master/stable
But it fails with:
Error: looks like "https://github.com/helm/charts/tree/master/stable"
is not a valid chart repository or cannot be reached: failed to fetch
https://github.com/helm/charts/tree/master/stable/index.yaml : 404 Not
Found
The stable repository is hosted on https://kubernetes-charts.storage.googleapis.com/. So, try the following:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
EDIT 2020-11-16: the above repository seems to have been deprecated. The following should now work instead:
helm repo add stable https://charts.helm.sh/stable
Be aware that Helm v3 does not have the use of Tiller.
1. Install Helm v3:
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
2. Install Ingress-Nginx:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm install my-nginx stable/nginx-ingress --set rbac.create=true
From Helm Blog -
On November 13, 2020 the stable and incubator charts repository will
reach the end of development and become archives. You can find that
many of the charts have moved to other, community managed,
repositories. You can discover these on the Artifact Hub.
The best way to discover a chart by searching the Artifact Hub. And if you select nginx-ingress from ORG Helm, you can see the instruction for adding a repo.
helm repo add nginx-stable https://helm.nginx.com/stable
Below solution worked for me.
# Below command is not working
$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/
Error: repo "https://kubernetes-charts.storage.googleapis.com/" is no longer available; try "https://charts.helm.sh/stable" instead
#Try this one, it's wokring.
$ helm repo add stable https://charts.helm.sh/stable
"stable" has been added to your repositories
The stable repositories are in helm hub https://hub.helm.sh/charts
Install the nginx chart for nginx ingress
helm install bitnami/nginx --version 6.2.0
I solved that problem by putting in this line:
helm repo add stable https://charts.jetstack.io