mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-04 20:43:59 +00:00
Update cheatsheets
This commit is contained in:
26
tldr/kubectl-patch
Normal file
26
tldr/kubectl-patch
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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:
|
||||
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}}\}\}'`
|
||||
Reference in New Issue
Block a user