Skip to content

Instantly share code, notes, and snippets.

@efossas
Created August 16, 2022 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save efossas/429b749c33a6bccf83abb5e2e66ae271 to your computer and use it in GitHub Desktop.
Save efossas/429b749c33a6bccf83abb5e2e66ae271 to your computer and use it in GitHub Desktop.
Kubectl Print All Contexts
contexts="$(cat "$KUBECONFIG" | yq e ".contexts[].name" -)";
for current_context in $contexts; do
kubectl config view --minify --flatten --context="$current_context" || echo "bad context: $current_context";
echo "---";
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment