Error creating service account using Helm on Kubernetes

1/4/2019

I am trying to create a service account using helm on Kubernetes as described here:

https://tutorials.kevashcraft.com/k8s/install-helm/

When I execute the following line:

kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

I get an error:

Error from server (BadRequest): invalid character 's' looking for beginning of object key string

Can someone give me some guidance as to what is wrong?

Thanks!

-- MrTouya
kubernetes
kubernetes-helm

1 Answer

1/4/2019

Try kubectl patch deploy --namespace kube-system tiller-deploy -p "{\"spec\":{\"template\":{\"spec\":{\"serviceAccount\":\"tiller\"}}}}" i.e. using outer double-quotes and escaping the inner double-quotes. There's a github issue where somebody hit the same error in a different context and was able to resolve it like this.

Edit: MrTouya determined that in this case what worked was kubectl patch deploy --namespace kube-system tiller-deploy -p '{\"spec\":{\"template\":{\"spec\":{\"serviceAccount\":\"tiller\"}}}}'

-- Ryan Dawson
Source: StackOverflow