Skip to content

Instantly share code, notes, and snippets.

@johnmarcou
Created February 12, 2018 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmarcou/fd75e027683cf5c2a92c0bdad8cb7de2 to your computer and use it in GitHub Desktop.
Save johnmarcou/fd75e027683cf5c2a92c0bdad8cb7de2 to your computer and use it in GitHub Desktop.
Merge kubeconfig files
kmerge() {
NEW_KUBECONFIG=$1
ACTIVE_KUBECONFIG=${KUBECONFIG:-~/.kube/config}
BACKUP_KUBECONFIG=$ACTIVE_KUBECONFIG.bak
cp $ACTIVE_KUBECONFIG $BACKUP_KUBECONFIG 2>/dev/null || :
KUBECONFIG=$BACKUP_KUBECONFIG:$NEW_KUBECONFIG kubectl config view --flatten > $ACTIVE_KUBECONFIG
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment