2
votes

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!

1

1 Answers

4
votes

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\"}}}}'