KUBERNETES(1) kubernetes KUBERNETES(1) (NAME) kubectl-patch - (SYNOPSIS) kubectl patch [OPTIONS] (DESCRIPTION) (strategic merge patch) JSON JSON. JSON YAML . : (Strategic merge patch) (custom resources) . (OPTIONS) --allow-missing-template-keys=true true map . golang jsonpath . --dry-run="none" "none" "server" "client" . client . server . --field-manager="kubectl-patch" . -f, --filename=[] URL -k, --kustomize="" kustomization. -f -R . --local=false true (patch) . -o, --output="" . : (json, yaml, kyaml, name, go-template, go-template- file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath- file). -p, --patch="" (patch) JSON . --patch-file="" . --record=false kubectl (annotation) . false . true . . -R, --recursive=false -f --filename. . --show-managed-fields=false true JSON YAML managedFields . --subresource="" patch (subresource) . --template="" -o=go-template -o=go-template-file. golang [http://golang.org/pkg/text/template/#pkg-overview]. --type="strategic" (patch) [json merge strategic] (OPTIONS INHERITED FROM PARENT COMMANDS) --as="" (impersonate) . (service account) . --as-group=[] . --as-uid="" UID . --as-user-extra=[] . --cache-dir="/home/username/.kube/cache" --certificate-authority="" (certificate authority) --client-certificate="" TLS --client-key="" TLS --cluster="" kubeconfig --context="" kubeconfig --disable-compression=false true --insecure-skip-tls-verify=false true . HTTPS --kubeconfig="" kubeconfig CLI. --kuberc="" kuberc (preferences). export feature gate KUBECTL_KUBERC=false KUBERC=off . --match-server-version=false -n, --namespace="" (namespace) CLI --password="" (basic authentication) API --profile="none" . (none|cpu|heap|goroutine|threadcreate|block|mutex|trace) --profile-output="profile.pprof" --request-timeout="0" . ( 1s 2m 3h). (timeout) . -s, --server="" Kubernetes API --tls-server-name="" . --token="" (Bearer token) API --user="" kubeconfig --username="" API --version=false --version --version=raw --version=vX.Y.Z... --warnings-as-errors=false (EXAMPLES) # JSON kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' # YAML kubectl patch node k8s-node-1 -p $'spec:0unschedulable: true' # "node.json" kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}' # spec.containers[*].name (merge key) kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}' # JSON (positional arrays) kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]' # (replicas) 'scale' (merge patch) kubectl patch deployment nginx-deployment --subresource='scale' --type='merge' -p '{"spec":{"replicas":2}}' (SEE ALSO) kubectl(1), (HISTORY) Eric Paris (eparis at redhat dot com) kubernetes ! Eric Paris Jan 2015 KUBERNETES(1)