kubectl --namespace=kube-system patch deployment tiller-deploy --type=json --patch='[{"op": "add", "path": "/spec/template/spec/containers/0/command", "value": ["/tiller", "--listen=localhost:44134"]}]'
Error: unknown flag: --listen
Examples:
# Partially update a node using a strategic merge patch. Specify the patch as JSON.
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
# Partially update a node using a strategic merge patch. Specify the patch as YAML.
kubectl patch node k8s-node-1 -p $'spec:\n unschedulable: true'
# Partially update a node identified by the type and name specified in "node.json" using strategic merge patch.
kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}'
# Update a container's image; spec.containers[*].name is required because it's a merge key.
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
# Update a container's image using a json patch with positional arrays.
kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
Options:
--allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
--dry-run=false: If true, only print the object that would be sent, without sending it.
-f, --filename=[]: Filename, directory, or URL to files identifying the resource to update
--local=false: If true, patch will operate on the content of the file, not the server-side resource.
-o, --output='': Output format. One of: json|yaml|name|templatefile|template|go-template|go-template-file|jsonpath|jsonpath-file.
-p, --patch='': The patch to be applied to the resource JSON file.
--record=false: Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
-R, --recursive=false: Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
--template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
--type='strategic': The type of patch being provided; one of [json merge strategic]
Usage:
kubectl patch (-f FILENAME | TYPE NAME) -p PATCH [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
unknown flag: --listen
This command that is in the documentation causes the above error. I am performing this command on windows cmd prompt.
Ah, windows machines may fail to do all the steps, I don't know how the cmd-prompt of windows will interpret all things and I guess this relates to how to it will understand things passed to it. This statement contains a lot of " and ' signs.
The --listen flag should not be interpreted by kubectl at all, and isn't on a UNIX terminal like on Mac or Linux, but apparently have ended up interpreted as part of what kubectl reads, so the issue lies in differences between UNIX and Windows terminal aspects now I think.
If I use windows and use a terminal, I always go for Cmder. I think it is out of scope for this guide to adjust everything to work on a typical Windows cmd-prompt. You could try using Cmder instead and perhaps you get further along the way doing that.
It would be great to learn about your progress or failure to progress on following the z2jh guide on a Windows machine!
Thanks, I will definitely give it a try. I was able to use windows to complete the entire process however this was the only portion that caused issue.
@aurashn wohooo awesome that was great to hear!
@consideRatio using the wsl (windows subsystem for linux) within the command prompt, I was able to apply the patch successfully. Thanks for the advice!
Most helpful comment
@consideRatio using the wsl (windows subsystem for linux) within the command prompt, I was able to apply the patch successfully. Thanks for the advice!