Created
November 13, 2023 13:21
-
-
Save maxihafer/a66b56f9cfccb7203bb40c34d52aa6ea to your computer and use it in GitHub Desktop.
kubeconfig runtime merging for kubectx & kubens
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
OIFS="$IFS" | |
IFS=$'\n' | |
KUBECONFIG_FILES=( $(find $HOME/.kube/ -type f -name 'kubeconfig.*.yaml') ) | |
IFS=$OIFS | |
KUBECONFIG=$(echo ${KUBECONFIG_FILES[@]} | tr ' ' ':') kubectl config view --flatten > $HOME/.kube/config | |
chmod 600 $HOME/.kube/config | |
export KUBECONFIG=$HOME/.kube/config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment