Kubernetes edit secret error: "cannot restore slice from..."

10/23/2018

I'm trying to edit a kubernetes secret using:

kubectl edit secret mysecret -o yaml

And adding a new variable on data:

data:
  NEW_VAR: true

But I receive the error:

cannot restore slice from bool

If I try to use some number, like:

data:
  NEW_VAR: 1

I receive another error after close the editor:

cannot restore slice from int64

What this error means?

-- Dherik
kubectl
kubernetes

1 Answer

10/23/2018

This error happens when the variable is not a valid base64 value.

So, to use the value true, you need to use his base64 representation:

NEW_VAR: dHJ1ZQ==
-- Dherik
Source: StackOverflow