Is this a BUG REPORT or FEATURE REQUEST?:
/kind bug
What happened:
kubectl --namespace=dev patch serviceaccount default -p '{"imagePullSecrets":[{"name":"gcr-json-key"}]}'
Fails with
Error from server: json: cannot unmarshal string into Go value of type map[string]interface {}
What you expected to happen:
Service account is updated
How to reproduce it (as minimally and precisely as possible):
Environment:
kubectl version
):Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.1", GitCommit:"f38e43b221d08850172a9a4ea785a86a3ffa3b3a", GitTreeState:"clean", BuildDate:"2017-10-11T23:27:35Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider or hardware configuration:
minikube
OS (e.g. from /etc/os-release):
Windows and minikube
I found the issue when I added --v=8.
JSON should be specified in the following way:
kubectl --namespace=dev patch serviceaccount default -p "{\"imagePullSecrets\":[{\"name\":\"gcr-json-key\"}]}"
Also I found out from --v=8,
the below worked for me (No qoutes for -p command)
kubectl patch horizontalpodautoscalers.autoscaling qa-master-instance -p {"spec":{"maxReplicas":4}}
I ran this
kubectl patch configmap/aws-auth -n kube-system --patch /aws-auth-patch.yml
but it shows the same error
Most helpful comment
I found the issue when I added --v=8.
JSON should be specified in the following way:
kubectl --namespace=dev patch serviceaccount default -p "{\"imagePullSecrets\":[{\"name\":\"gcr-json-key\"}]}"