Hello everyone,
I'm trying to use a kubectl patch command to update a deployment by changing a metadata label on my deployment, the command i'm using is this one:
kubectl patch deployment my-deployment -n my-namespace -p '{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"redeploy\":\"55\"}}}}}'
When running it on power shell it works perfectly but when i add it to my pipeline i get all sorts of errors, currently my step is as follows:
INFO: running kubectl command patch deployment my-deployment using generic handler
kubectl patch deployment my-deployment -n my-namespace -p '{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"redeploy\":\"55\"}}}}}'
Error from server (BadRequest): json: cannot unmarshal string into Go value of type map[string]interface {}
I've tried scaping that string in all sorts of ways but nothing works, even tried using the yaml style for the patch command with the same outcome. Is there something obvious i'm missing here?
Answering my own question, it seems that the kubectl version being using a little far behind the current version, so the correct syntax was:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.