From 69c6cb07de2372efa3937d2a45886cd5e9570a49 Mon Sep 17 00:00:00 2001 From: Paolo Antinori Date: Fri, 27 Oct 2017 00:05:13 +0200 Subject: [PATCH] kubectl-cheatsheet - patch, added example for add (#4546) * kubectl-cheatsheet - patch, added example for add * Changed patch example to use k8s native resource * Removed line from kubectl-cheatsheet --- docs/user-guide/kubectl-cheatsheet.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/kubectl-cheatsheet.md b/docs/user-guide/kubectl-cheatsheet.md index 5a6ed85593..de6a9e1351 100644 --- a/docs/user-guide/kubectl-cheatsheet.md +++ b/docs/user-guide/kubectl-cheatsheet.md @@ -159,7 +159,6 @@ $ kubectl autoscale deployment foo --min=2 --max=10 # Auto scale ``` ## Patching Resources -Patch a resource(s) with a strategic merge patch. ```console $ kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' # Partially update a node @@ -172,6 +171,9 @@ $ kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spe # Disable a deployment livenessProbe using a json patch with positional arrays $ kubectl patch deployment valid-deployment --type json -p='[{"op": "remove", "path": "/spec/template/spec/containers/0/livenessProbe"}]' + +# Add a new element to a positional array +$ kubectl patch sa default --type='json' -p='[{"op": "add", "path": "/secrets/1", "value": {"name": "whatever" } }]' ``` ## Editing Resources