我正在尝试使用以下命令安装 helm 版本
helm upgrade --install --reset-values {release-name} ../chart --namespace test01 --values /tmp/values737957648
未打包的图表以展开形式保存。
此操作失败并出现以下错误,它基本上尝试存储发布信息
sh.helm.release.v1.{release-name}.v1" is invalid: data: Too long: must have at most 1048576 characters
如何调试这个问题?
如果我尝试生成图表的模板并执行 kubectl create ,它就会安装得很好。即
helm template {release-name} chart --namespace test01 --values /tmp/values737957648 >> test1.yaml
kubectly create test1.yaml (No configmap/No secret limit issue)
尝试通过 helm 安装并尝试创建 helm-secret 时会出现问题
我该如何解决这个问题?
我使用的是helm版本
helm version
version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f",
GitTreeState:"clean", GoVersion:"go1.13.5"}
就我而言,根本原因非常出乎意料:图表文件夹包含 xxxx.tgz 文件(存档文件被错误地留在那里),直到它被删除,我一直收到此错误。错误消息甚至不接近真正的根本原因。
在我的例子中,我有一个包含一些图像的“img/”目录...周末我添加了许多大的 png 文件...并且出现了类似的错误...
% 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
经过漫长的一天进行了丑陋的 Helm 调试后,我将“img/”文件夹移出图表目录并再次工作......
所以:请将精彩的文档和不相关的 Helm 图表文件保存在您开发图表的
线索:生成清单文件,应用它们并检查是否正确
% helm template mychart chart --values ./values.yaml > debug.yaml
% kubectl apply -f debug.yaml
% kubectl delete -f debug.yaml
du . --block-size=KB
,令人惊讶的是有一个
.kube
文件夹,里面有很多数据,删除后问题解决了。
du -sh $(ls -A)
命令查找大文件夹或文件。将隐藏的
.git 目录添加到 .helmignore 文件中解决了我的问题,错误消息与问题标题相同。
.helmignore 内容示例:
*.txt
.git
例如:debug.log 或 my_readme.txt
我删除了所有与舵图无关的文件,并且工作正常。
Helm 错误具有误导性。
du -sh /path/to/helm/chart/directory
根据我的经验,当意外文件(例如 .pdf 文件)被错误地留在 Helm 图表目录中时,我遇到了类似的问题。这使目录的大小增加到超过 1MB。删除不需要的文件并确保目录大小低于1MB后,问题解决了。