I'm using Helm 3 and microk8s. When I try a dry run:
microk8s.helm install <...> --dry-run --debug
I see errors like
Error: YAML parse error on ./templates/deployment.yaml: error converting YAML to JSON: yaml: mapping values are not allowed in this context
helm.go:76: [debug] error converting YAML to JSON: yaml: mapping values are not allowed in this context
YAML parse error on ./templates/deployment.yaml
helm.sh/helm/v3/pkg/releaseutil.(*manifestFile).sort
/home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:129
helm.sh/helm/v3/pkg/releaseutil.SortManifests
/home/circleci/helm.sh/helm/pkg/releaseutil/manifest_sorter.go:98
helm.sh/helm/v3/pkg/action.(*Configuration).renderResources
/home/circleci/helm.sh/helm/pkg/action/install.go:455
helm.sh/helm/v3/pkg/action.(*Install).Run
/home/circleci/helm.sh/helm/pkg/action/install.go:214
main.runInstall
...
I found several questions with a similar error, but the answer is usually just asking for read a chart code. I have a large chart and need to debug this error on my own. And guessing which line it complains about doesn't seem meaningful.
Is there a way to know what exactly is wrong in the config?
You can use a --set flag in your Helm commands to override the value of a setting in the YAML file. Specify the name of the setting and its new value after the --set flag in the Helm command. The --set flag in the above command overrides the value for the <service>. deployment.
After the Helm chart installation is complete, you can verify the installation. Note: Add --cleanup to the command to delete the testing pods after the command is run. You can also check the deployed Kubernetes resources by running one of the following commands: oc get all -n {namespace}
Try: helm template ... --debug > foo.yaml
This'll output the rendered chart to foo.yaml (and the helm error stacktrace to stderr). Then find the template filename in question from the helm error and look through the rendered chart for a line like # Source: the-template-name.yaml
. YAML to JSON conversion is done separately for each YAML object, so you may have multiple instances of the same # Source: the-template-name.yaml
.
Look n lines below each # Source: ...
comment for an error, where n is the line number of the error reported by Helm render.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With