From 7bb1acf3dd8404a9b650c127756e95c17f6a4a47 Mon Sep 17 00:00:00 2001 From: Deepika Pandhi Date: Fri, 27 Sep 2019 13:03:37 -0700 Subject: [PATCH] removed longer version to fetch labels for pods #14778 (#16268) * updated OR comments * removed older long version to fetch labels for pods to use only kubectl get pods --show-labels --- content/en/docs/reference/kubectl/cheatsheet.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index d6a7c441c8..a6f39e5f82 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -182,10 +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 - -# Or this command can be used as well to get all the labels associated with pods kubectl get pods --show-labels # Check which nodes are ready