Skip to content

Instantly share code, notes, and snippets.

@echo-devnull
Created November 4, 2022 21:00
Show Gist options
  • Save echo-devnull/812d662aae58f7c365acd4c673272a16 to your computer and use it in GitHub Desktop.
Save echo-devnull/812d662aae58f7c365acd4c673272a16 to your computer and use it in GitHub Desktop.
Merging seperate kubeconfig files into one
function mergeKubeConfigs() {
kube_config_dir="$HOME/.kube/config.d/"
for f in `ls $kube_config_dir | grep config.`
do
export KUBECONFIG="$kube_config_dir/$f:$KUBECONFIG";
done
kubectl config view --raw >> ~/.kube/config
unset KUBECONFIG
export KUBECONFIG="$HOME/.kube/config"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment