kubectl patch
Patch Kubernetes resources with new values. More information: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_patch/.
- Partially patch a secret using a strategic merge JSON patch to remove the finalizer:
kubectl patch secrets '{"metadata":{"finalizers": []\}\}' --type merge
- Partially patch a secret using a strategic merge YAML patch to remove the finalizer:
kubectl patch secrets $'metadata:\n finalizers: []' --type merge
- Partially patch a pod's container using a JSON patch with positional arrays:
kubectl patch --type 'json' '[{"op": "replace", "path": "/spec/containers/0/image", "value":""}]'
- Update a deployment's replicas through the scale subresource using a strategic merge JSON patch:
kubectl patch --subresource 'scale' --type 'merge' '{"spec":{"replicas":\}\}'
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
