Added --show-labels (#14779)

* updated OR comments

* updated comments from review for --show-labels
This commit is contained in:
Deepika Pandhi 2019-06-18 15:36:32 -07:00 committed by Kubernetes Prow Robot
parent cc4c4789ce
commit 658f5c498d
1 changed files with 3 additions and 0 deletions

View File

@ -182,6 +182,9 @@ echo $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name
# Also uses "jq" # 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 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 # Check which nodes are ready
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \ JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \
&& kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=True" && kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=True"