How to fix json unmarshal error while executing kubectl patch command?

hal

When following tutorial: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/ i run into error. The following command fails:

kubectl patch sts web -p '{"spec":{"replicas":3}}'

Error from server (BadRequest): json: cannot unmarshal string into Go value of type map[string]interface {}

How do I fix this?

This is the container image on pods: k8s.gcr.io/nginx-slim:0.8

I am using minikube on Windows 7 Pro and standard cmd shell.

kubectl version

Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", 
GitCommit:"2bd9643cee5b3b3a5ecbd3af
9d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", 
GoVersion:"go1.12.9", Compiler:"gc"
Platform:"windows/amd64"}

Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", 
GitCommit:"2bd9643cee5b3b3a5ecbd3af
9d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", 
GoVersion:"go1.12.9", Compiler:"gc"
Platform:"linux/amd64"}
apisim

Try surrounding it with double quotes and then escaping the double quotes inside:

kubectl patch sts web -p "{\"spec\":{\"replicas\":3}}"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

json Unmarshal error

How to pass image pull secret while using 'kubectl run' command?

TerminatorExpectedAtEndOfString error while executing powershell command in java

Build command failed. Error while executing process

Error while executing sqoop eval command

How to fix this error "Syntax Error" while running CLI command

How to fix "cannot unmarshal !!str `image:j...` into config.RawService" error while running docker compose on ecs-cli?

How to update secret with "kubectl patch --type='json'"

how to fix the unhandled error while executing the angular application

How to fix error occuring while executing EValidator

How to fix "Celery is receiving tasks but while executing it stuck"

How to fix error "mismatch" in Xcode while trying to decode JSON

How to handle Invalid command name error, while executing ("after" script) in tkinter python

how to fix Laravel Error when executing the route

Error while executing linux command using Java

Error while executing a sql command in c#

Error while executing awk command in shell script

getting error while executing mongo command

Python: Perforce client error while remotely executing command

How to resolve the error while executing top command using node child_process.exec?

Error while executing command inside script

How to fix Tcl 'Command not found' error while trying to puts error variable?

Invalid reference format error while executing docker stack deploy command

Ansible cant parse kubectl patch command

kubectl patch existing container command

How do I fix bugs while executing matlab standalone applications?

How to hide open window while executing a command?

error : numeric argument required while executing jq command

json: cannot unmarshal object into Go value of type jsonpatch.Patch - How to Fix