Skip to content

Instantly share code, notes, and snippets.

@maxihafer
Created November 13, 2023 13:21
Show Gist options
  • Save maxihafer/a66b56f9cfccb7203bb40c34d52aa6ea to your computer and use it in GitHub Desktop.
Save maxihafer/a66b56f9cfccb7203bb40c34d52aa6ea to your computer and use it in GitHub Desktop.
kubeconfig runtime merging for kubectx & kubens
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