demo: Error from server: Invalid JSON Patch

After running:

$ kubectl patch offlinevirtualmachine testvm --type merge -p '{"spec":{"running":true}}'

I get the $SUBJECT error.

C:\minikube> kubectl get --all-namespaces pods
NAMESPACE     NAME                                    READY     STATUS    RESTARTS   AGE
kube-system   kube-addon-manager-minikube             1/1       Running   0          24m
kube-system   kube-dns-54cccfbdf8-grdkr               3/3       Running   0          24m
kube-system   kubernetes-dashboard-77d8b98585-66pxb   1/1       Running   0          24m
kube-system   storage-provisioner                     1/1       Running   0          24m
kube-system   virt-controller-5c74754ddd-5p4cx        1/1       Running   0          15m
kube-system   virt-controller-5c74754ddd-tbhkf        0/1       Running   0          15m
kube-system   virt-handler-c887w                      1/1       Running   0          15m

Shouldn’t also the virt-controller-5c74754ddd-tbhkf running? I am following this guide

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

I’m sharing this having gone through the same battle yesterday with the kubectl run command. If you’re running this on Windows using Powershell you’ll need to create a variable and assign the JSON (using the ConvertTo-Json routine) first. Then use that variable in your kubectl commands.

From the OP’s code:

$ kubectl patch offlinevirtualmachine testvm --type merge -p '{"spec":{"running":true}}'

Becomes:

$myjson = '{"spec":{"running":true}}' | ConvertTo-Json
$ kubectl patch offlinevirtualmachine testvm --type merge -p $myjson

Hope that helps! 😃

Approach originally found at: https://stackoverflow.com/a/53481499/40593

thanks for the correction @stealthybox !

Yes. Check this: https://www.virtualbox.org/ticket/4032 9 years …