kubectl-{diff, patch}: add page (#18414)

Signed-off-by: varnika <varnika@ibm.com>
This commit is contained in:
Varnika Sinha
2025-10-08 17:47:02 -04:00
committed by GitHub
parent 55ebe23ad0
commit 670eb0478f
2 changed files with 28 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
# kubectl diff
> Check differences between live resources and files.
> More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_diff>.
- View differences between the live resource and file definition:
`kubectl diff {{[-f|--filename]}} {{path/to/filename}}`
+20
View File
@@ -0,0 +1,20 @@
# 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 {{secret_name}} {{[-p|--patch]}} '{"metadata":{"finalizers": []\}\}' --type merge`
- Partially patch a secret using a strategic merge YAML patch to remove the finalizer:
`kubectl patch secrets {{secret_name}} {{[-p|--patch]}} $'metadata:\n finalizers: []' --type merge`
- Partially patch a pod's container using a JSON patch with positional arrays:
`kubectl patch {{[po|pods]}} {{pod_name}} --type 'json' {{[-p|--patch]}} '[{"op": "replace", "path": "/spec/containers/0/image", "value":"{{new_image_value}}"}]'`
- Update a deployment's replicas through the scale subresource using a strategic merge JSON patch:
`kubectl patch {{[deploy|deployments]}} {{deployment_name}} --subresource 'scale' --type 'merge' {{[-p|--patch]}} '{"spec":{"replicas":{{number_of_replicas}}\}\}'`