Error converting YAML to JSON

Hi, Following the instruction of Jupyterhub for Kubenetes, I want to enable https on our jupyterhub. So I create myconfig.yaml:

proxy:
  https:
    enabled: true
    type: manual
    manual:
      key: |
        -----BEGIN RSA PRIVATE KEY-----
        ....here is the content from our private key file.
        -----END RSA PRIVATE KEY-----
      cert: |
        -----BEGIN CERTIFICATE-----
        ....here is the content from our cert file.
        -----END CERTIFICATE-----

When I run microk8s helm3 upgrade, I got error:

Error: failed to parse myconfig.yaml: error converting YAML to JSON: yaml: line 9: could not find expected β€˜:’
helm.go:84: [debug] error converting YAML to JSON: yaml: line 9: could not find expected β€˜:’
failed to parse myconfig.yaml
helm.sh/helm/v3/pkg/cli/values.(*Options).MergeValues
helm.sh/helm/v3/pkg/cli/values/options.go:54
main.newUpgradeCmd.func2
helm.sh/helm/v3/cmd/helm/upgrade.go:142
github.com/spf13/cobra.(*Command).execute
github.com/spf13/cobra@v1.4.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/cobra@v1.4.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/cobra@v1.4.0/command.go:902
main.main
helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
runtime/proc.go:250
runtime.goexit
runtime/asm_amd64.s:1598

The line 9 in myconfig.yaml is content of the private key. So I am confused where is the problem?

hard to say without the exact yaml (redacted and rightfully so), but this suggests to me an indentation problem. Make sure the hanging indent for the key/cert are right and there’s no mixing tabs and spaces.

You can try also loading your file locally with a yaml parser to check:

import yaml
with open("myconfig.yaml") as f:
    yaml.safe_load(f)
1 Like

Thanks. It is the indentation problem which happens when I input the private key and cert. It works now.