Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JefClaes
Last active August 18, 2020 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JefClaes/a9ad52f713fb7ab47db716701bd52baa to your computer and use it in GitHub Desktop.
Save JefClaes/a9ad52f713fb7ab47db716701bd52baa to your computer and use it in GitHub Desktop.
Compare image versions between kubernetes contexts
CONTEXTS=("a" "b" "c")
FILES=()
for CTX in ${CONTEXTS[@]}; do
kubectl config use-context $CTX
FN="$CTX.txt"
kubectl get pods --all-namespaces -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq > $FN
FILES+=("$FN")
done
printf -v X ' %s' "${FILES[@]}"
eval "vim -d ${X[*]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment