From ebfb3ba40c0d3fbf2c810c0275646ba2e64d8306 Mon Sep 17 00:00:00 2001 From: Deepika Pandhi Date: Tue, 11 Jun 2019 11:31:46 -0700 Subject: [PATCH 1/2] updated OR comments --- content/en/docs/reference/kubectl/cheatsheet.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index ecec12f3be4b7..f0684b83ba588 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -185,7 +185,12 @@ echo $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name # Also uses "jq" for item in $( kubectl get pod --output=name); do printf "Labels for %s\n" "$item" | grep --color -E '[^/]+$' && kubectl get "$item" --output=json | jq -r -S '.metadata.labels | to_entries | .[] | " \(.key)=\(.value)"' 2>/dev/null; printf "\n"; done +<<<<<<< HEAD # Or this command can be used as well to get all the labels associated with pods +======= +# OR + +>>>>>>> updated OR comments kubectl get pods --show-labels # Check which nodes are ready From 422a71401aea13f4a18354f808c44b84bd18c1fc Mon Sep 17 00:00:00 2001 From: dpandhi-git Date: Mon, 9 Sep 2019 12:31:06 -0700 Subject: [PATCH 2/2] removed older long version to fetch labels for pods to use only kubectl get pods --show-labels --- content/en/docs/reference/kubectl/cheatsheet.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index f0684b83ba588..8fd5ab99970ee 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -182,15 +182,6 @@ sel=${$(kubectl get rc my-rc --output=json | jq -j '.spec.selector | to_entries echo $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name}) # Show labels for all pods (or any other Kubernetes object that supports labelling) -# Also uses "jq" -for item in $( kubectl get pod --output=name); do printf "Labels for %s\n" "$item" | grep --color -E '[^/]+$' && kubectl get "$item" --output=json | jq -r -S '.metadata.labels | to_entries | .[] | " \(.key)=\(.value)"' 2>/dev/null; printf "\n"; done - -<<<<<<< HEAD -# Or this command can be used as well to get all the labels associated with pods -======= -# OR - ->>>>>>> updated OR comments kubectl get pods --show-labels # Check which nodes are ready