How can I create my own helm chart package from the kube-prometheus-stack charts on github - kubernetes

I'm trying to create my own helm chart package for prometheus and its components but I am trying to reuse parts of the kube-prometheus-stack helm chart on github : https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack
I've modified the templates to my liking but when I try to create a package for them which I can then upload it to my repo I get the following :
helm package prometheus-chart/
Error: found in Chart.yaml, but missing in charts/ directory: alertmanager, kube-state-metrics, prometheus-node-exporter, prometheus-pushgateway
How can I get the templates from that repo, and create a deployable package from my local machine which I can then share it?

These components alertmanager, kube-state-metrics, prometheus-node-exporter, prometheus-pushgateway are added as dependencies in the Chart.yaml. So the helm will check whether these dependencies are built or not.
So you need to build the dependencies as well by using this command
$ helm dependency build CHARTNAME
Example:
$ helm dependency build alertmanager
Once the dependencies are built you can update them using update command
$ helm dependency update CHARTNAME
For more detailed information refer to this official documents doc1 doc2

There are dependencies added in the Chart.yml file that are not downloaded, you need to run the command helm dependency build <CHART> in order to fetch them

Related

Do I have to run "helm dependency update" every time I change subchart?

I have a repo, where I develop 2 charts. Root chart and a sub-chart.
This is a root chart's chart.lock
apiVersion: v2
name: tolgee
description: A Helm chart to deploy Tolgee
type: application
version: 0.1.0
appVersion: 1.16.0
dependencies:
- name: tolgee
version: 0.1.0
repository: "file://../tolgee"
alias: tolgee
I am using this chart to actually deploy the thing to my cluster.
While I am working on the project, I am often also changing the sub-chart stored in ../tolgee. Every time I make a change I need to run helm dep update. To get the updated version. I wonder, why the subchart has to be stored as .tgz, when it might simply be a link.
Am I doing something wrong?
If one chart depends on another, you can put an unpacked copy of the dependency into the parent chart's charts subdirectory.
This should work with a symlink, too. So if you're actively working on the subchart but need to install it via the parent, you should be able to
mkdir charts
cd charts
ln -s ../../tolgee tolgee
If you watch carefully what helm dep up does, it copies in an archive file charts/tolgee-0.1.0.tgz. While the dependency is in that compressed form, you do in fact need to run helm dep up if you make any change.

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.

Confused with Helm dependency management

In my parent chart Chart.yaml I have
dependencies:
- name: postgresql11
repository: "#myrepo"
version: 8.9.7
condition: postgresql11.enabled
- name: postgresql12
repository: "#myrepo"
version: 8.9.7
condition: postgresql12.enabled
In the same parent chart values.yaml I have:
postgresql11:
enabled: true
postgresql12:
enabled: false
My problem is that unless I run helm dep update neither subchart is downloaded and installed (I'm expecting the postgresql11 subchart to be installed). If I run helm dep update both subcharts are pulled, ignoring my ruleset which indicates that only postgresql11 should be installed.
Can anybody shed some light on what I'm doing wrong here, and what the relationship is between helm dependency build/update and the conditional rules in Chart.yaml? I'm also curious why there is an enabled field in Chart.yaml which seems redundant with the condition field? I'm running Helm 3.2.4.
Thanks in advance!
The command helm dep update does not use values.yaml and that is why your dependencies are updated even if you have them disabled in values.yaml.
To understand the enabled for dependencies, read the section "Tags and Condition fields in dependencies" in the Helm: Charts documentation.
helm dependency update command will download all the subchart specified in the dependencies option and download it to the charts/ directory, even you have them disabled in values.yaml. However, only enabled charts will be installed.
To release the new changes/version you need to run the command helm upgrade <chart-name> <chart-dir-location>.
Please refer https://helm.sh/docs/helm/helm_upgrade/
Helm Dependency Update:
Update the on-disk dependencies to mirror Chart.yaml.
This command 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.
On successful update, this will generate a lock file that can be used to rebuild the dependencies to an exact version.
Helm Dependency Build:
Build out the charts/ directory from the Chart.lock file.
Build is used to reconstruct a chart's dependencies to the state specified in the lock file. This will not re-negotiate dependencies, as 'helm dependency update' does.
If no lock file is found, 'helm dependency build' will mirror the behavior of 'helm dependency update'.

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

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.