Created
August 16, 2022 02:34
-
-
Save efossas/429b749c33a6bccf83abb5e2e66ae271 to your computer and use it in GitHub Desktop.
Kubectl Print All Contexts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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