35

I'm trying to add a new pod to my helm chart, it passes validation (helm lint) but fails at last stage of deployment:

Mon Dec 16 10:01:58 2019 INFO Running helm install/upgrade for xyz-stg
UPGRADE FAILED Error: "" is invalid: patch: Invalid value: "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\"
(...)
ReadString: expects " or n, but found t, error found in #10 byte of ...|,"value":true},{"nam|..., bigger context ...|"value":"stg"}, (...)
Error: UPGRADE FAILED: "" is invalid: patch: Invalid value: "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\": (...)
ReadString: expects " or n, but found t, error found in #10 byte of ...|,"value":true},{"nam|..., bigger context ...|"value":"stg"}, (...) Mon Dec 16 10:02:09 2019 ERROR Upgrade/Installation of xyz-stg failed

I have no idea what this error means or how to even debug it. It sounds like some syntax indentation error, but all I did was: copy-pasted the pod configuration from other working pod and changed all names.

4
  • you have an empty value somewhere in your chart.
    – c4f4t0r
    Dec 16, 2019 at 9:58
  • @c4f4t0r Based on this error (it's longer) is there a way to find which variable is empty? When I change anything I get configMap already exists in the cluster error. Anyhow, it does create the POD regardless, although it's pending due to some tainted nods - are these errors related in any way? Dec 16, 2019 at 10:24
  • helm template can help you
    – c4f4t0r
    Dec 16, 2019 at 10:35
  • The actual error here is: ``` expects " or n, but found t, error found in #10 byte of ...|,"value":true} ``` So there is a piece in the Deployment yaml with yaml "value": true But it wants: yaml "value": "true"
    – Dirc
    Nov 10, 2021 at 18:50

4 Answers 4

49

I ran into a similar problem and apparently it turns out Kubernetes's Pod specification requires environment variable values to be coerced as strings, so integers need to be passed through quote.So, in your deployment.yaml file wherever you are using the numeric values try to pass them as below.

value: {{ .Values.environment.TEMP | quote}}

It will work just fine after that. Hope it helps

1
  • 8
    I found out that a value of "True" or "False" needs to be quoted as well Aug 26, 2020 at 13:31
12

Add double quotes and update the deployment.yaml with following changes

In deployment.yaml file

        value: {{ .Values.environment.TEMP }}
        value: {{ quote .Values.environment.TEMP }}

In Values.yaml file

Envrionment:
  TEMP: "true"
2

Helm lint - Will not capture this error. For env values / Boolean check - It is recommended to use quote. Below is an example, Assuming zookeeperConnectionTimeout has an entry in values.yml

value: {
    {
        .Values.zookeeperConnectionTimeout | quote
    }
}

To Check: You can use helm template to see the actual substituted values before applying install.

Actual substituted value will be something like below:

value: "180000"
1

I ran into this adding an annotation from PowerShell. Tried several things before discovering <double><single><value><single><double>

helm upgrade userprofile $helmfile.ToString() --install --wait --timeout 90s
--set ingress.annotations."nginx.ingress.kubernetes.io/auth-tls-verify-depth"="'1'"
--set ingress.annotations."nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream"="'false'"

In Azure DevOps HelmDeploy@0 task arguments I needed <double><single><single><value><single><single><double>.

  - task: HelmDeploy@0
    displayName: 'Install UserProfile'
    inputs:
      ...
      command: upgrade
      arguments: '
        ...
        --set ingress.annotations."nginx\.ingress\.kubernetes\.io/auth-tls-verify-depth"="''1''"
        --set ingress.annotations."nginx\.ingress\.kubernetes\.io/auth-tls-pass-certificate-to-upstream"="''false''"'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.