I'm translating a service manual from Linux to Windows command line, and running into some issues with escape characters. After looking at other entries here and general googling I haven't been able to find anything that works for whatever reason.
In this line:
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "demo-registry"}]}' -n testNamespace
I'm unable to find a combination of <code>`</code>, ^
, or \
that allows me to escape the double quotes. I was able to get it to work in the powershell command below though.
kubectl patch serviceaccount default -p "{\`"imagePullSecrets\`": [{\`"name\`": \`"demo-registry\`"}]}" -n testNamespace
Inverting the " and 's around the inputs allows the command to run without needing escape characters. The errors I had received were in part due to issues with my local environment.
kubectl patch serviceaccount default -p "{'imagePullSecrets': [{'name': 'demo-registry'}]}" -n testNamespace