helm fails with failed to create: Secret "sh.helm.release.v1.(release-name).v1" is invalid: data: Too long: must have at most 1048576 character
Asked Answered
A

11

23

I am trying to install a helm release, using following command

helm upgrade --install --reset-values {release-name} ../chart --namespace test01 --values /tmp/values737957648

The chart is not packaged is kept in the expanded form.

This fails with the below error, where it basically trying to store release information

sh.helm.release.v1.{release-name}.v1" is invalid: data: Too long: must have at most 1048576 characters

How to go about debugging this problem?

if I try to generate the template of the chart and do kubectl create it gets installed fine .i.e.

helm template {release-name} chart --namespace test01 --values /tmp/values737957648 >> test1.yaml
kubectly create test1.yaml  (No configmap/No secret limit issue)

The problem occurs when trying to install via helm and it tries to create helm-secret

How could I approach to solve this issue ?

I am using helm version

helm version
version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", 
GitTreeState:"clean", GoVersion:"go1.13.5"}
Averir answered 27/10, 2020 at 12:44 Comment(2)
How big is the values file you're trying to use here? (Are you trying to inject large config files, via a Helm value, into a ConfigMap?)Bronson
I am mounting db sql files in configmap (and they used to work) ,and they are not crossing the limit of 1 mb as I could create the template (using helm template) and apply it ( using kubeclt create) ofcourse-when using kubeclt helm.sh is not created to maintain histoy.Averir
S
25

In my case the root cause was very unexpected: the chart folder contained the xxxx.tgz file (the archive file left there by mistake) and until it was deleted, I got this error all the time. The error message isn't even close to the real root cause.

Spada answered 9/6, 2021 at 14:9 Comment(4)
After you removed the data over 1 MB, the error disappeared. How does it not describe the root cause? Do note that I agree the error could absolutely be made more helpful.Nanananak
As I haven't put this file to the folder explicitly, the root cause was not clear until I had fount the wrong file, that has nothing to do with helm secrets. File had no characters, mentioned as a part of secret details, so... It's not just completely wrong, it is misleadingSpada
Yes, I agree. It's basically an implementation detail that Helm drops the whole chart to K8s as a Secret so that it can know the diff to the next chart version/release (and allow rollback etc.). Currently open relevant issue in Helm repo (but I guess you are the author): github.com/helm/helm/issues/9788Nanananak
God bless Stack-O.Mock
P
10

in my case I had a "img/" directory with some images... at weekend I add many big png files... and a similar error appear...

% helm upgrade --install {release name} {mychart} -f values-mychart-custom.yaml --debug
    history.go:56: [debug] getting history for release mychart
    Release "mychart" does not exist. Installing it now.
    install.go:178: [debug] Original chart version: ""
    install.go:199: [debug] CHART PATH: Library/Caches/helm/repository/mychart-1.0.0.tgz

Error: create: failed to create: Secret "sh.helm.release.v1.mychart.v1" is invalid: data: Too long: must have at most 1048576 bytes
helm.go:88: [debug] Secret "sh.helm.release.v1.mychart.v1" is invalid: data: Too long: must have at most 1048576 bytes
create: failed to create
helm.sh/helm/v3/pkg/storage/driver.(*Secrets).Create
    helm.sh/helm/v3/pkg/storage/driver/secrets.go:164
helm.sh/helm/v3/pkg/storage.(*Storage).Create
    helm.sh/helm/v3/pkg/storage/storage.go:69
helm.sh/helm/v3/pkg/action.(*Install).RunWithContext
    helm.sh/helm/v3/pkg/action/install.go:340
main.runInstall
    helm.sh/helm/v3/cmd/helm/install.go:265
main.newUpgradeCmd.func2
    helm.sh/helm/v3/cmd/helm/upgrade.go:124
github.com/spf13/cobra.(*Command).execute
    github.com/spf13/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
    github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
    github.com/spf13/[email protected]/command.go:902
main.main
    helm.sh/helm/v3/cmd/helm/helm.go:87
runtime.main
    runtime/proc.go:255
runtime.goexit
    runtime/asm_amd64.s:1581

after a loooong day doing an ugly Helm debug, I move the "img/" folder out of the chart directory and all working again....

so: please keep your awesome documentation and non-related Helm chart files outside the charts/* directories where you are developing your charts...

:)

The clue: generate manifest files, apply them and check all it's right

% helm template mychart chart --values ./values.yaml > debug.yaml
% kubectl apply -f debug.yaml
% kubectl delete -f debug.yaml
Puentes answered 3/11, 2021 at 3:33 Comment(1)
You can add files/directories to .helmignore to help get rid of this error too.Kike
E
8

This answer is straight from: https://jhooq.com/helm-chart-failed-to-create/

The root cause behind this issue can be one of the following -

  1. Helm release name consists of upper-case (ex - helm install demoChart helloworld)
  2. Helm release name consists of blank spaces (ex - helm install demo Chart helloworld)
  3. Helm release name consists of special character (ex - helm install demoCh@rt helloworld)

In my case, I had underscore in my chart name. When I replaced underscores with dashes, chart deployed just fine.

Enfleurage answered 7/2, 2021 at 0:11 Comment(2)
This does not answer the question - no mention of "data: Too long" in the linked page.Nanananak
I had the same issue with the underscore. Funny how helm create does not validate the release nameBucentaur
M
4

I did an du . --block-size=KB and surprisingly there was a .kube folder which had a lot data in it, after removing that the problem solved.

Michelinamicheline answered 25/11, 2021 at 11:15 Comment(0)
W
4

Move all files out of helm directory and then try to move them back in small chunks to see which folder/file contains this issue. Alternatively use du -sh $(ls -A) command to look for big folders or files.

Adding hidden .git directory into .helmignore file solved my issue with the same error message as in question title.

.helmignore content example:

*.txt
.git
While answered 6/6, 2022 at 13:55 Comment(1)
Thanks so much. This worked for met too, after trying everything else.Hearne
R
3

I have faced a similar issue today and it was because I have some additional files in my helm directory.

ex: debug.log or my_readme.txt

I removed all the files that are not relevant to the helm chart and it worked fine.

Helm errors are misleading.

Renshaw answered 4/2, 2022 at 10:12 Comment(0)
A
1

One common cause of this issue is the size of the Helm chart directory itself. The directory containing the Helm chart files, along with any additional files or artifacts, contributes to the size of the data stored in Kubernetes Secrets. If the total size of the Helm chart directory exceeds 1MB, it can result in this error. You can use the du command to check the size of the directory:

du -sh /path/to/helm/chart/directory

In my experience, I encountered a similar issue when an unexpected file, such as a .pdf file, was mistakenly left in the Helm chart directory. This increased the size of the directory beyond 1MB. After removing the unnecessary file and ensuring that the size of the directory was below 1MB, the issue was resolved.

Actually answered 26/4 at 19:55 Comment(0)
S
0

Check, if you have any unused helm files in your helm chart folder. In my case I accidentally downloaded some big-size binary, and it caused similar issue.

Stop answered 23/5, 2022 at 22:24 Comment(0)
P
0

In my case it was .git folder the problem.
Using .helmignore file is the solution to ignore unwanted files:

https://helm.sh/docs/chart_template_guide/helm_ignore_file/

Pettway answered 24/2, 2023 at 15:5 Comment(1)
Please use proper capitalisation.Bahena
H
0

deleting the .tgz file of what you are trying to install worked for me.

Hypsometry answered 26/6, 2023 at 5:59 Comment(0)
M
0

in my case was to ignore certain files by adding a .helmignore file.

Mccrory answered 2/7 at 5:54 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Hawse

© 2022 - 2024 — McMap. All rights reserved.