helm icon indicating copy to clipboard operation
helm copied to clipboard

Helm 3: Generation of Helm secrets is failing

Open HoaFox opened this issue 7 years ago • 28 comments

Hi,

I am using for the moment Helm 3.0.0-beta.4 for deploying OpenFaaS to my K8s cluster. Unfortunately I get the following error when I try to install OpenFaaS directly from the chart source:

Error: create: failed to create: Secret "sh.helm.release.v1.openfaas.v1" is invalid: data: Too long: must have at most 1048576 characters

Steps to reproduce:

  1. git clone https://github.com/openfaas/faas-netes.git
  2. kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
  3. kubectl -n openfaas create secret generic basic-auth --from-literal=basic-auth-user=admin --from-literal=basic-auth-password=admin
  4. helm install openfaas faas-netes/chart/openfaas/ --namespace openfaas --set basic_auth=true --set functionNamespace=openfaas-fn

HoaFox avatar Oct 20 '19 19:10 HoaFox

I'm having the same issue with a reasonable sized Chart consisting of multiuple services. Here the debug output:

install.go:148: [debug] Original chart version: ""
install.go:165: [debug] CHART PATH: /Users/marco/Projects/helm-3-test

Error: create: failed to create: Secret "sh.helm.release.v1.name.v1" is invalid: data: Too long: must have at most 1048576 characters
helm.go:76: [debug] Secret "sh.helm.release.v1.name.v1" is invalid: data: Too long: must have at most 1048576 characters
create: failed to create
helm.sh/helm/v3/pkg/storage/driver.(*Secrets).Create
	/home/circleci/helm.sh/helm/pkg/storage/driver/secrets.go:160
helm.sh/helm/v3/pkg/storage.(*Storage).Create
	/home/circleci/helm.sh/helm/pkg/storage/storage.go:66
helm.sh/helm/v3/pkg/action.(*Install).Run
	/home/circleci/helm.sh/helm/pkg/action/install.go:261
main.runInstall
	/home/circleci/helm.sh/helm/cmd/helm/install.go:209
main.newInstallCmd.func1
	/home/circleci/helm.sh/helm/cmd/helm/install.go:115
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main
	/home/circleci/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357

marcopaga avatar Oct 31 '19 14:10 marcopaga

Doesn't replicate on helm-3.0.0-rc.3

kazdy@kostkafuji:~/faas-netes$ helm install openfaas ./chart/openfaas/ --namespace openfaas --set basic_auth=true --set functionNamespace=openfaas-fn
NAME: openfaas
LAST DEPLOYED: Fri Nov  8 20:46:10 2019
NAMESPACE: openfaas
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
To verify that openfaas has started, run:

  kubectl --namespace=openfaas get deployments -l "release=openfaas, app=openfaas"
kazdy@kostkafuji:~/faas-netes$ kubectl --namespace=openfaas get deployments
NAME                READY   UP-TO-DATE   AVAILABLE   AGE
alertmanager        1/1     1            1           4m2s
basic-auth-plugin   1/1     1            1           4m2s
faas-idler          1/1     1            1           4m2s
gateway             1/1     1            1           4m2s
nats                1/1     1            1           4m2s
prometheus          1/1     1            1           4m2s
queue-worker        1/1     1            1           4m2s
kazdy@kostkafuji:~/faas-netes$ kubectl --namespace=openfaas get secrets
NAME                              TYPE                                  DATA   AGE
basic-auth                        Opaque                                2      6m3s
default-token-nkcnp               kubernetes.io/service-account-token   3      6m4s
openfaas-controller-token-vdcd7   kubernetes.io/service-account-token   3      30s
openfaas-prometheus-token-hgmq7   kubernetes.io/service-account-token   3      30s
sh.helm.release.v1.openfaas.v1    helm.sh/release.v1                    1      30s

kazdy@kostkafuji:~/faas-netes$ kubectl get secrets sh.helm.release.v1.openfaas.v1 --namespace=openfaas -o yaml | yq r - data.release | wc -c
45681

kazdy@kostkafuji:~/faas-netes$ helm version
version.BuildInfo{Version:"v3.0.0-rc.3", GitCommit:"2ed206799b451830c68bff30af2a52879b8b937a", GitTreeState:"clean", GoVersion:"go1.13.4"}

Is it specific to minikube? I used kind cluster (deployed with https://github.com/kubanczyk/kind-restart/blob/master/kind-restart.sh)

kubanczyk avatar Nov 08 '19 19:11 kubanczyk

helm-3.0.0-rc.3 fixed the issue.

HoaFox avatar Nov 09 '19 09:11 HoaFox

@HoaFox this is still happening with helm 3.0.0

bobbui avatar Nov 15 '19 23:11 bobbui

I see this happening with me as well on 3.0.0

tfreiling avatar Nov 23 '19 19:11 tfreiling

It turns out it was failing for me because I had too large of files. But it would be nice if it reported the actual length as well in the error message.

tfreiling avatar Nov 26 '19 02:11 tfreiling

Works for me now. I had helm deployed in the chart directory to give it a test. I added the binary to the .helmignore and it works perfect. :)

marcopaga avatar Nov 27 '19 20:11 marcopaga

Is there a way to modify this parameter to allow more than 1048576 characters?

tfreiling avatar Nov 30 '19 04:11 tfreiling

etcd (the storage backend for Kubernetes) has a 1MB size limit for objects. You could look into how to modify those settings, but it's not something that can be tuned within Helm.

see also #4865

bacongobbler avatar Nov 30 '19 05:11 bacongobbler

The title of this maybe should be updated to reflect 3.0.0, since it persists after beta. Also it seems like this one is confirmed and pretty deep, dunno if there's a tag for that, but, seems to me it is entirely workable right now.

SpamapS avatar Dec 02 '19 20:12 SpamapS

I'm facing the same issue too with helm v.3.0.2. How can I delete or flush old release history? I didn't find anything about it... I need to clear the history because, even executing helm upgrade with --history-max flag, helm first tries to deploy and register the deployment on the history before try to delete old ones. A sub argument could be added to helm history that gives us the power to delete old history easily:

helm history delete 3 -> would delete 3 entries starting from the oldest one helm history delete 3 --reverse -> would delete 3 entries starting from the newest one

galindro avatar Jan 22 '20 10:01 galindro

@galindro This command will give you all secrets created by Helm 3: kubectl get secret --all-namespaces -l "owner=helm"

You can remove the release versions then by using the command: kubectl delete secret -n <namespace> <secret-name>

hickeyma avatar Jan 22 '20 10:01 hickeyma

Tks @hickeyma

galindro avatar Jan 22 '20 17:01 galindro

My chart also get too big so I'm currently looking for a workaround. Helm 2 docs recommends me to use SQL as a storage backend instead of Secrets. sql-storage-backend

Unfortunately, SQL is not supported in Helm 3 helm/helm-www#422. So.... do I have any workaround? (apart from downgrading Helm back to Helm 2, of course)

Edit: I use .helmignore to ignore somes of my file and it's working! Anyway I'm still wonder that will SQL driver be supported in Helm 3 ? thanks

catflyflyfly avatar Feb 12 '20 05:02 catflyflyfly

I faced the same issue. It wasn't because my template files were too large but because a lot of unnecessary files were added to the chart, which resulted in bloating up the size of the secret used to store the release data. The main culprit is the .git directory: I store my Chart files in a Git repo, and my deployment process pulls the chart files, renders it then deploys it. Since pulling/cloning the repo will create a .git directory with a few Megabytes of data (depending on the repos metadata, branches, etc.), the content of that directory will be added to the chart. To fix this, I used a .helmignore file to exclude the unnecessary files/directories like .git https://helm.sh/docs/chart_template_guide/helm_ignore_file/

hamzb avatar Mar 03 '20 13:03 hamzb

I got this, because I had an .idea/ folder in my chart. Putting that in .helmignore solved the problem.

oreza avatar Mar 08 '20 02:03 oreza

If this can help someone, for me, I was packaging my chart inside my chart's directory, and each time I ran a package command again I was taking my old package inside (because my helmignore didn't ignore my .tgz files) so it was getting bigger at each package and I ran into that error

RomanPanaget avatar Jun 11 '20 10:06 RomanPanaget

Is there a fix for this ? Can i tell helm not to keep history ? Trying to trim our chart.

Update: 2020-07 I think my size increase was caused by the use of $ helm secrets upgrade (using sops encryption) Im updating my .helmignore to exclude the secrets.yaml, else they and the decrypted secrets.yaml.dec endup in the helm history.

diepes avatar Jul 05 '20 13:07 diepes

Get the same error in helm version v3.2.4 with a small chart

Updates

See the problem in current latest version v3.3.0 as well

ozbillwang avatar Aug 26 '20 23:08 ozbillwang

I have used 3.3.0 a hundred times, and now it started erring out same. I am running against EKS 1.17.

Update.

For me, it was user error. I got around this by copying my .gitignore into my .helmignore (wasn't keeping them in sync).

ronaldpetty avatar Sep 02 '20 01:09 ronaldpetty