Skip to content

Instantly share code, notes, and snippets.

@tonidy
Last active August 2, 2021 03:25
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 tonidy/9d005b81b170a3b46256ec9e4a943ced to your computer and use it in GitHub Desktop.
Save tonidy/9d005b81b170a3b46256ec9e4a943ced to your computer and use it in GitHub Desktop.
Merge 2 kubernetes config files
## Using:
## to see newconfig
## make view newconfig=~/new-config.yaml
## to merge configs
## make merge newconfig=~/new-config.yaml
view::
cp ~/.kube/config ~/.kube/config.bak && KUBECONFIG=~/.kube/config:$(newconfig) kubectl config view --flatten > /tmp/config && cat /tmp/config
merge::
cp ~/.kube/config ~/.kube/config.bak && KUBECONFIG=~/.kube/config:$(newconfig) kubectl config view --flatten > /tmp/config && mv /tmp/config ~/.kube/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment