Created
September 18, 2025 19:10
-
-
Save jmarhee/5a485607631e8b94d1f87a34bb3196d0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
KUBECONFIG_DIR=$HOME/.kube | |
mkdir -p "$KUBECONFIG_DIR" | |
clusters=$(rancher clusters ls --format '{{.Cluster.Name}}') | |
for cluster in $clusters; do | |
echo "Downloading kubeconfig for cluster: $cluster" | |
rancher clusters kubeconfig "$cluster" > "$KUBECONFIG_DIR/$cluster-kubeconfig.yaml" | |
echo "Kubeconfig for $cluster saved to $KUBECONFIG_DIR/$cluster-kubeconfig.yaml" | |
done | |
echo "All kubeconfigs have been downloaded." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment